From d17a6885253da909e376ba5ca5084f5281f3557c Mon Sep 17 00:00:00 2001 From: Tianjie Xu Date: Mon, 9 Jan 2017 11:18:29 -0800 Subject: Add checkers and tests for empty locale in PNG file match_locale() will return false for empty locale string in the PNG file. Also add a manual test to validate if a PNG file is qualified to use under recovery. Bug: 34054052 Test: recovery_manual_test catches invalid PNG files successfully & Locale_test passed Change-Id: Id7e2136e1d8abf20da15825aa7901effbced8b03 --- minui/resources.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'minui') diff --git a/minui/resources.cpp b/minui/resources.cpp index e6909f269..726c627ed 100644 --- a/minui/resources.cpp +++ b/minui/resources.cpp @@ -374,7 +374,9 @@ int res_create_alpha_surface(const char* name, GRSurface** pSurface) { // This function tests if a locale string stored in PNG (prefix) matches // the locale string provided by the system (locale). bool matches_locale(const char* prefix, const char* locale) { - if (locale == NULL) return false; + if (locale == nullptr) { + return false; + } // Return true if the whole string of prefix matches the top part of // locale. For instance, prefix == "en" matches locale == "en_US"; -- cgit v1.2.3