From bec41947b691f8a993a3048c2c58e8e1fa36d276 Mon Sep 17 00:00:00 2001 From: randomdan Date: Sat, 7 Jan 2012 17:05:30 +0000 Subject: Initialise flags properly and only use script when there is one --- project2/common/commonObjects.cpp | 12 ++++++++---- 1 file 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(&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; } -- cgit v1.2.3