Reading shape source was skipping line 1. #16.

This commit is contained in:
Rob Greene 2018-06-23 23:13:56 -05:00
parent f025fef9bb
commit a4a96e04f4

View File

@ -20,13 +20,9 @@ public class ShapeGenerator {
String line = reader.readLine(); String line = reader.readLine();
Consumer<String> shapeConsumer = null; Consumer<String> shapeConsumer = null;
while (line != null) { while (line != null) {
line = reader.readLine();
if (line == null) break;
int comment = line.indexOf(';'); int comment = line.indexOf(';');
if (comment > -1) line = line.substring(0, comment); if (comment > -1) line = line.substring(0, comment);
line = line.trim(); line = line.trim();
if (line.length() == 0) continue;
switch (line.toLowerCase()) { switch (line.toLowerCase()) {
case ".short": case ".short":
@ -45,7 +41,9 @@ public class ShapeGenerator {
shapeConsumer = bitmapShape::appendBitmapRow; shapeConsumer = bitmapShape::appendBitmapRow;
break; break;
default: default:
if (shapeConsumer != null) { if (line.length() == 0) {
// do nothing
} else if (shapeConsumer != null) {
try { try {
shapeConsumer.accept(line); shapeConsumer.accept(line);
} catch (Throwable t) { } catch (Throwable t) {
@ -57,6 +55,7 @@ public class ShapeGenerator {
} }
break; break;
} }
line = reader.readLine();
} }
return st; return st;
} }