From 2e3aa333a573960edf2d782bca3b25a01e49678b Mon Sep 17 00:00:00 2001 From: Jakob Krigovsky Date: Fri, 10 Mar 2017 10:44:59 +0100 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20continue=20execution=20when=20e?= =?UTF-8?q?rror=20occurs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- icuWrapper.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/icuWrapper.cpp b/icuWrapper.cpp index 0d90d8e3..440e01ea 100644 --- a/icuWrapper.cpp +++ b/icuWrapper.cpp @@ -16,6 +16,7 @@ NAN_METHOD(DetectCharacterEncoding) { if(U_FAILURE(errorCode)) { Nan::ThrowError("Failed to open ICU charset detector."); + return; } ucsdet_setText( @@ -27,24 +28,28 @@ NAN_METHOD(DetectCharacterEncoding) { if(U_FAILURE(errorCode)) { Nan::ThrowError("Failed to set ICU charset detector’s text."); + return; } charsetMatch = ucsdet_detect(charsetDetector, &errorCode); if(U_FAILURE(errorCode)) { Nan::ThrowError("Failed to detect charset."); + return; } const char *charsetName = ucsdet_getName(charsetMatch, &errorCode); if(U_FAILURE(errorCode)) { Nan::ThrowError("Failed to get name from charset match."); + return; } int32_t confidence = ucsdet_getConfidence(charsetMatch, &errorCode); if(U_FAILURE(errorCode)) { Nan::ThrowError("Failed to get confidence from charset match."); + return; } v8::Local obj = Nan::New();