if you run your code using input_242.txt from ivan_sidarau examples application will crash. It is due to this wrong condition