Fixed that very few institutes send an empty fourth data element

This commit is contained in:
dankito 2020-04-29 01:46:41 +02:00
parent 071c0a1b8d
commit 4b657bf1b9
1 changed files with 1 additions and 1 deletions

View File

@ -19,7 +19,7 @@ open class ReceivedSegment(
*/
constructor(segmentHeader: List<String>, segmentString: String) :
this(segmentHeader[0], segmentHeader[1].toInt(), segmentHeader[2].toInt(),
if (segmentHeader.size >= 4) segmentHeader[3].toInt() else null, segmentString)
if (segmentHeader.size >= 4 && segmentHeader[3].isNotBlank()) segmentHeader[3].toInt() else null, segmentString)
constructor(segmentString: String) : this(
segmentString.split(Separators.DataElementGroupsSeparator).first().split(Separators.DataElementsSeparator),