don't call functions on nullptr
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user