qmlbook/qmlbook — pull request #2 by justinfx (2014-10-25 19:38:02+00:00)
Title: ch02: FileIO - Infinite loop reading csv

back-link: ch02/index.html#console-application

QString.isEmpty() returns true both for cases where it is an empty string value AND when it is null, so performing this check first and using continue will loop forever

This:

if(line.isEmpty()) {
continue;
}
if(line.isNull()) {
break;
}
Should be changed to

if(line.isNull()) {
break;
}
if(line.isEmpty()) {
continue;
}