From 0d56abf2530d93f00443868281b9a3c73174a605 Mon Sep 17 00:00:00 2001 From: Murai Takashi Date: Tue, 28 Jan 2020 20:30:55 +0900 Subject: [PATCH] libroot/add-ons/icu: Fix PVS V595 Check 'in' pointer against NULL before using it. Change-Id: I4d7605df168b6e4f8a2ae61ff942ce1a8ba78321 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2203 Reviewed-by: waddlesplash --- src/system/libroot/add-ons/icu/ICUCollateData.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/system/libroot/add-ons/icu/ICUCollateData.cpp b/src/system/libroot/add-ons/icu/ICUCollateData.cpp index d300b4551a..b949db290e 100644 --- a/src/system/libroot/add-ons/icu/ICUCollateData.cpp +++ b/src/system/libroot/add-ons/icu/ICUCollateData.cpp @@ -113,6 +113,11 @@ ICUCollateData::Strcoll(const char* a, const char* b, int& result) status_t ICUCollateData::Strxfrm(char* out, const char* in, size_t size, size_t& outSize) { + if (in == NULL) { + outSize = 0; + return B_OK; + } + if (fCollator == NULL || strcmp(fPosixLocaleName, "POSIX") == 0) { // handle POSIX here as the collator ICU uses for that (english) is // incompatible in too many ways @@ -124,11 +129,6 @@ ICUCollateData::Strxfrm(char* out, const char* in, size_t size, size_t& outSize) return B_OK; } - if (in == NULL) { - outSize = 0; - return B_OK; - } - UnicodeString unicodeIn; if (_ToUnicodeString(in, unicodeIn) != B_OK) return B_BAD_VALUE;