don't call functions on nullptr

This commit is contained in:
2025-04-10 14:59:31 -05:00
parent 6a5856b027
commit dfeacb3b40
3 changed files with 9 additions and 10 deletions

View File

@@ -19,10 +19,15 @@ void MinimalApp::run() {
toClose.clear();
for(auto m : toOpen) {
static Archimedes::Module* n;
if(std::holds_alternative<std::string>(m)) {
load(std::get<std::string>(m))->onLoad();
n = load(std::get<std::string>(m));
} else {
load(std::get<Archimedes::Module*>(m))->onLoad();
n = load(std::get<Archimedes::Module*>(m));
}
if(n) {
n->onLoad();
n = nullptr;
}
}
toOpen.clear();