sylothix / upk-modder

Automatically exported from code.google.com/p/upk-modder
0 stars 0 forks source link

String parser does not accept null strings #27

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Insert string 1F 00 (null string)

What is the expected output? What do you see instead?
Unreal parser should accept as a valid set of unreal hex, but it is treated as 
invalid hex.

Please use labels and text to provide additional information.

Original issue reported on code.google.com by miss.inv...@gmail.com on 13 Jan 2014 at 2:55

GoogleCodeExporter commented 8 years ago
Discovered that the parser DOES in fact handle null strings (1F 00), but not 
when they are the last tokens at the end of a line.

Original comment by miss.inv...@gmail.com on 19 Jan 2014 at 6:17

GoogleCodeExporter commented 8 years ago
Problem was with line:
   int length = s.split("00")[0].length()/3;

in ModStringLeaf.ParseUnrealHex(). If s == "00" this would result in the split 
being null, and the [0] reference being invalid.

Fixed by putting a previous conditional :
  if( !((s.split("\\s", 2)[0]).equals("00")))

to skip attempting to parse character data for null strings.

Original comment by miss.inv...@gmail.com on 25 Feb 2014 at 6:57