# HG changeset patch # User Santeri Piippo # Date 1377072579 -10800 # Node ID e41b6e1e3299c625ef14dde1ea3708119530590f # Parent f2faed6546338e7f3e52d4c35ad71dff29d66bd1 Fixed crash with closing: since logoed studs are now loaded, the first file in g_loadedFiles is not explicit anymore. the closing code assumed this diff -r f2faed654633 -r e41b6e1e3299 src/file.cpp --- a/src/file.cpp Wed Aug 21 10:54:33 2013 +0300 +++ b/src/file.cpp Wed Aug 21 11:09:39 2013 +0300 @@ -130,10 +130,16 @@ // file as something else. if (this == LDFile::current()) { // If we closed the last file, create a blank one. - if (g_loadedFiles.size() == 0) + if (countExplicitFiles() == 0) newFile(); - else - LDFile::setCurrent (g_loadedFiles[0]); + else { + // Find the first explicit file loaded + int idx = 0; + while (g_loadedFiles[idx]->implicit()) + idx++; + + LDFile::setCurrent (g_loadedFiles[idx]); + } } g_win->updateFileList();