don't call functions on nullptr
This commit is contained in:
@@ -95,10 +95,9 @@ namespace Archimedes {
|
|||||||
if(*it == m->getName()) {
|
if(*it == m->getName()) {
|
||||||
std::cout << "Module \"" << *it << "\" is already loaded!\n";
|
std::cout << "Module \"" << *it << "\" is already loaded!\n";
|
||||||
delete m;
|
delete m;
|
||||||
std::cout << "m deleted successfully!\n";
|
if(h) {
|
||||||
if(h)
|
|
||||||
dlclose(h);
|
dlclose(h);
|
||||||
std::cout << "h dlclose successfully!\n";
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -121,7 +120,6 @@ namespace Archimedes {
|
|||||||
|
|
||||||
bool skip = false;
|
bool skip = false;
|
||||||
for(auto it : m->deps) {
|
for(auto it : m->deps) {
|
||||||
//std::cout << "Module " << m->getName() << " has dependency " << it.first << std::endl;
|
|
||||||
for(auto s : runOrder) {
|
for(auto s : runOrder) {
|
||||||
if(s == it.first) {
|
if(s == it.first) {
|
||||||
skip = true;
|
skip = true;
|
||||||
|
|||||||
@@ -19,10 +19,15 @@ void MinimalApp::run() {
|
|||||||
toClose.clear();
|
toClose.clear();
|
||||||
|
|
||||||
for(auto m : toOpen) {
|
for(auto m : toOpen) {
|
||||||
|
static Archimedes::Module* n;
|
||||||
if(std::holds_alternative<std::string>(m)) {
|
if(std::holds_alternative<std::string>(m)) {
|
||||||
load(std::get<std::string>(m))->onLoad();
|
n = load(std::get<std::string>(m));
|
||||||
} else {
|
} else {
|
||||||
load(std::get<Archimedes::Module*>(m))->onLoad();
|
n = load(std::get<Archimedes::Module*>(m));
|
||||||
|
}
|
||||||
|
if(n) {
|
||||||
|
n->onLoad();
|
||||||
|
n = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
toOpen.clear();
|
toOpen.clear();
|
||||||
|
|||||||
@@ -24,10 +24,6 @@ class MinimalApp : public Archimedes::App {
|
|||||||
|
|
||||||
void run();
|
void run();
|
||||||
|
|
||||||
//void stopModule(std::list<Archimedes::Module*>::iterator);
|
|
||||||
|
|
||||||
//void startModule(std::string);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define APP_TYPE MinimalApp
|
#define APP_TYPE MinimalApp
|
||||||
|
|||||||
Reference in New Issue
Block a user