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

@@ -95,10 +95,9 @@ namespace Archimedes {
if(*it == m->getName()) {
std::cout << "Module \"" << *it << "\" is already loaded!\n";
delete m;
std::cout << "m deleted successfully!\n";
if(h)
if(h) {
dlclose(h);
std::cout << "h dlclose successfully!\n";
}
return nullptr;
}
}
@@ -121,7 +120,6 @@ namespace Archimedes {
bool skip = false;
for(auto it : m->deps) {
//std::cout << "Module " << m->getName() << " has dependency " << it.first << std::endl;
for(auto s : runOrder) {
if(s == it.first) {
skip = true;

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();

View File

@@ -24,10 +24,6 @@ class MinimalApp : public Archimedes::App {
void run();
//void stopModule(std::list<Archimedes::Module*>::iterator);
//void startModule(std::string);
};
#define APP_TYPE MinimalApp