diff options
-rw-r--r-- | project2/common/commonObjects.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/project2/common/commonObjects.cpp b/project2/common/commonObjects.cpp index 0e58cc8..f27696f 100644 --- a/project2/common/commonObjects.cpp +++ b/project2/common/commonObjects.cpp @@ -4,19 +4,23 @@ #include "appEngine.h" #include "scriptLoader.h" -CommonObjects::CommonObjects() +CommonObjects::CommonObjects() : + scriptLoaded(true) { } CommonObjects::CommonObjects(ScriptNodePtr s) : - script(s->script) + script(s->script), + scriptLoaded(false) { s->script->loader.addLoadTarget(s, Storer::into<ElementLoader>(&rowSets)); } CommonObjects::~CommonObjects() { - script->loader.discardLoadTargets(); + if (script) { + script->loader.discardLoadTargets(); + } } RowSetPtr @@ -37,7 +41,7 @@ CommonObjects::loadDataSource(const std::string & name) const void CommonObjects::loadScriptComponents() const { - if (!scriptLoaded) { + if (!scriptLoaded && script) { script->load(this, true); scriptLoaded = true; } |