Skip to content

Commit 7c11ff2

Browse files
committed
Resolve #523 7 Better null checks on CIF block command skips. Also clean up <bool> == false.
1 parent 3e708ba commit 7c11ff2

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

storage/io/src/main/java/org/openscience/cdk/io/CIFReader.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -188,16 +188,12 @@ private IChemFile readChemFile(IChemFile file) throws IOException {
188188
// skip command
189189
logger.warn("Skipping command: ", command);
190190
line = input.readLine();
191-
if (line.startsWith(";")) {
191+
if (line != null && line.startsWith(";")) {
192192
logger.debug("Skipping block content");
193-
line = input.readLine();
194-
if (line != null) line = line.trim();
195-
while (!line.equals(";")) {
196-
line = input.readLine();
197-
if (line != null) line = line.trim();
193+
while ((line = input.readLine()) != null &&
194+
!line.startsWith(";")) {
198195
logger.debug("Skipping block line: ", line);
199196
}
200-
line = input.readLine();
201197
}
202198
}
203199
}
@@ -336,7 +332,7 @@ private String processAtomLoopBlock(String firstLine) throws IOException {
336332
}
337333
line = input.readLine().trim();
338334
}
339-
if (hasParsableInformation == false) {
335+
if (!hasParsableInformation) {
340336
logger.info("No parsable info found");
341337
return skipLoopBody(line);
342338
} else {

0 commit comments

Comments
 (0)