src/file.cpp

changeset 509
dcacfd2cd81b
parent 508
7ace3537a560
child 510
ee90c55dfeef
equal deleted inserted replaced
508:7ace3537a560 509:dcacfd2cd81b
279 // ============================================================================= 279 // =============================================================================
280 // ----------------------------------------------------------------------------- 280 // -----------------------------------------------------------------------------
281 void FileLoader::work (int i) 281 void FileLoader::work (int i)
282 { // User wishes to abort, so stop here now. 282 { // User wishes to abort, so stop here now.
283 if (aborted()) 283 if (aborted())
284 { for (LDObject * obj : m_objs) 284 { for (LDObject* obj : m_objs)
285 delete obj; 285 delete obj;
286 286
287 m_objs.clear(); 287 m_objs.clear();
288 setDone (true); 288 setDone (true);
289 return; 289 return;
296 { str line = lines() [i]; 296 { str line = lines() [i];
297 297
298 // Trim the trailing newline 298 // Trim the trailing newline
299 qchar c; 299 qchar c;
300 300
301 while ( (c = line[line.length() - 1]) == '\n' || c == '\r') 301 while (!line.isEmpty() && (c = line[line.length() - 1]) == '\n' || c == '\r')
302 line.chop (1); 302 line.chop (1);
303 303
304 LDObject* obj = parseLine (line); 304 LDObject* obj = parseLine (line);
305 305
306 // Check for parse errors and warn about tthem 306 // Check for parse errors and warn about tthem

mercurial