File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -210,6 +210,7 @@ func ParseMessageWithDataDictionary(
210210
211211 trailerBytes := []byte {}
212212 foundBody := false
213+ foundTrailer := false
213214 for {
214215 parsedFieldBytes = & msg .fields [fieldIndex ]
215216 if xmlDataLen > 0 {
@@ -228,6 +229,7 @@ func ParseMessageWithDataDictionary(
228229 msg .Header .add (msg .fields [fieldIndex : fieldIndex + 1 ])
229230 case isTrailerField (parsedFieldBytes .tag , transportDataDictionary ):
230231 msg .Trailer .add (msg .fields [fieldIndex : fieldIndex + 1 ])
232+ foundTrailer = true
231233 default :
232234 foundBody = true
233235 trailerBytes = rawBytes
@@ -247,6 +249,12 @@ func ParseMessageWithDataDictionary(
247249 fieldIndex ++
248250 }
249251
252+ // This will happen if there are no fields in the body
253+ if foundTrailer && ! foundBody {
254+ trailerBytes = rawBytes
255+ msg .bodyBytes = nil
256+ }
257+
250258 // Body length would only be larger than trailer if fields out of order.
251259 if len (msg .bodyBytes ) > len (trailerBytes ) {
252260 msg .bodyBytes = msg .bodyBytes [:len (msg .bodyBytes )- len (trailerBytes )]
You can’t perform that action at this time.
0 commit comments