From 830bb3ba5e37f547f836a9c793f6084b305a4bfb Mon Sep 17 00:00:00 2001 From: jacob1 Date: Fri, 13 Sep 2013 12:53:40 -0400 Subject: [PATCH] fix !load -1 crash --- src/cat/TPTScriptInterface.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/cat/TPTScriptInterface.cpp b/src/cat/TPTScriptInterface.cpp index e82155973..6519aec4e 100644 --- a/src/cat/TPTScriptInterface.cpp +++ b/src/cat/TPTScriptInterface.cpp @@ -439,9 +439,13 @@ AnyType TPTScriptInterface::tptS_load(std::deque * words) //Arguments from stack NumberType saveID = eval(words); - c->OpenSavePreview(saveID.Value(), 0, false); - - return NumberType(0); + if (saveID.Value() > 0) + { + c->OpenSavePreview(saveID.Value(), 0, false); + return NumberType(0); + } + else + throw GeneralException("Invalid save ID"); } AnyType TPTScriptInterface::tptS_bubble(std::deque * words)