App doesn't crash when attempting to open bad file through double click

This commit is contained in:
Yousef Khadadeh 2026-06-04 17:16:26 +03:00
parent 354c6e4cdc
commit 12bb936c16
5 changed files with 11 additions and 15 deletions

View file

@ -560,19 +560,17 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char **argv) {
mS.m->set_first_screen(std::make_unique<FileSelectScreen>(*mS.m));
else {
mS.m->set_first_screen(std::make_unique<DesktopDrawingProgramScreen>(*mS.m));
if(listOfFilesToOpenFromCommand.empty()) {
for(std::filesystem::path& f : listOfFilesToOpenFromCommand) {
mS.m->create_new_tab({
.isClient = false,
.filePathSource = f
});
}
if(mS.m->worlds.empty()) {
mS.m->create_new_tab({
.isClient = false
});
}
else {
for(std::filesystem::path& f : listOfFilesToOpenFromCommand) {
mS.m->create_new_tab({
.isClient = false,
.filePathSource = f
});
}
}
}
mS.m->update(); // Run update once to make sure that callbacks dont crash