From 944daa78f76d110d3a2bec5ab8b2a4cae26bf027 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 2 Jun 2016 18:45:59 -0700 Subject: [PATCH] Add nullcheck to eliminate warning with Code Analysis --- Release/src/utilities/asyncrt_utils.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Release/src/utilities/asyncrt_utils.cpp b/Release/src/utilities/asyncrt_utils.cpp index ab502ac5c5..fac7787d49 100644 --- a/Release/src/utilities/asyncrt_utils.cpp +++ b/Release/src/utilities/asyncrt_utils.cpp @@ -63,7 +63,7 @@ scoped_c_thread_locale::xplat_locale scoped_c_thread_locale::c_locale() scoped_c_thread_locale::xplat_locale *clocale = new scoped_c_thread_locale::xplat_locale(); #ifdef _WIN32 *clocale = _create_locale(LC_ALL, "C"); - if (*clocale == nullptr) + if (clocale == nullptr || *clocale == nullptr) { throw std::runtime_error("Unable to create 'C' locale."); } @@ -74,7 +74,7 @@ scoped_c_thread_locale::xplat_locale scoped_c_thread_locale::c_locale() }; #else *clocale = newlocale(LC_ALL, "C", nullptr); - if (*clocale == nullptr) + if (clocale == nullptr || *clocale == nullptr) { throw std::runtime_error("Unable to create 'C' locale."); }