NASAWorldWind / WorldWindJava

The NASA WorldWind Java SDK (WWJ) is for building cross-platform 3D geospatial desktop applications in Java.
712 stars 324 forks source link

Read VPF header generate Exception #263

Open GogoTrash opened 1 year ago

GogoTrash commented 1 year ago

When I try to read a VPF header with an empty narrative table name, it generates a StringIndexOutOfBoundsException in the VPFTableReader because it's empty at the line 200 (in the readHeader(ByteBuffer) method):

...
// Read the narrative table name.
s = VPFUtils.readDelimitedText(buffer, ';'); // <= Return an empty String
if (s != null && s.charAt(0) != '-') //<= And here s.charAt(0) return a StringIndexOutOfBoundsException
      header.narrativeTableName = s.trim();
...

I think if we add a condition if !s.isEmpty() it could resolve the problem. Thanks