From 1a61ed7cbbbebf1da8a6f605e0fb636cc86d60e4 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Mon, 28 Dec 2015 22:11:14 -0800 Subject: [PATCH] Print NULL instead of crashing for CString.toCYON. --- Execute.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Execute.cpp b/Execute.cpp index 6156422..41ba583 100644 --- a/Execute.cpp +++ b/Execute.cpp @@ -1764,8 +1764,12 @@ static JSValueRef CString_callAsFunction_toCYON(JSContextRef context, JSObjectRe Pointer *internal(reinterpret_cast(JSObjectGetPrivate(_this))); const char *string(static_cast(internal->value_)); std::ostringstream str; - str << "&"; - CYStringify(str, string, strlen(string), true); + if (string == NULL) + str << "NULL"; + else { + str << "&"; + CYStringify(str, string, strlen(string), true); + } std::string value(str.str()); return CYCastJSValue(context, CYJSString(CYUTF8String(value.c_str(), value.size()))); } CYCatch(NULL) } -- 2.45.2