From 2242ac939448eec81bbef845fbc7e141cdabba41 Mon Sep 17 00:00:00 2001 From: Sandu Liviu Catalin Date: Fri, 17 Jun 2016 03:26:29 +0300 Subject: [PATCH] Make constructor public in script container. Throw exception if trying to create script container with invalid VM. --- source/Base/ScriptSrc.cpp | 7 ++++++- source/Base/ScriptSrc.hpp | 7 ------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/source/Base/ScriptSrc.cpp b/source/Base/ScriptSrc.cpp index 20e03f6f..209b1b49 100644 --- a/source/Base/ScriptSrc.cpp +++ b/source/Base/ScriptSrc.cpp @@ -150,8 +150,13 @@ ScriptSrc::ScriptSrc(HSQUIRRELVM vm, const String & path, bool info) { throw std::runtime_error("Invalid or empty script path"); } + // Is the specified virtual machine invalid? + else if (!vm) + { + throw std::runtime_error("Invalid virtual machine pointer"); + } // Should we load the file contents for debugging purposes? - if (info) + else if (info) { Process(); } diff --git a/source/Base/ScriptSrc.hpp b/source/Base/ScriptSrc.hpp index e935da9e..2820a6d4 100644 --- a/source/Base/ScriptSrc.hpp +++ b/source/Base/ScriptSrc.hpp @@ -19,9 +19,6 @@ class Core; */ class ScriptSrc { - // -------------------------------------------------------------------------------------------- - friend class Core; - public: // -------------------------------------------------------------------------------------------- @@ -33,8 +30,6 @@ public: String mData; // The contents of the script file. Line mLine; // List of lines of code in the data. -private: - /* -------------------------------------------------------------------------------------------- * Read file contents and calculate information about the lines of code. */ @@ -45,8 +40,6 @@ private: */ ScriptSrc(HSQUIRRELVM vm, const String & path, bool info = false); -public: - /* -------------------------------------------------------------------------------------------- * Copy constructor. */