From 0cdeccbc97d3f5946f4ef18f47cdce6b8da173ae Mon Sep 17 00:00:00 2001 From: chyyy0213 Date: Thu, 17 Feb 2022 10:12:27 +0800 Subject: [PATCH] js GetColorFromJs bugfix Signed-off-by: chyyy0213 Change-Id: Icea80da330e9c1bc0b1f613958cac6f6171f5451 --- .../kits/napi/window_runtime/window_napi/js_window_utils.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interfaces/kits/napi/window_runtime/window_napi/js_window_utils.cpp b/interfaces/kits/napi/window_runtime/window_napi/js_window_utils.cpp index 7e863d93..663b8198 100644 --- a/interfaces/kits/napi/window_runtime/window_napi/js_window_utils.cpp +++ b/interfaces/kits/napi/window_runtime/window_napi/js_window_utils.cpp @@ -174,8 +174,8 @@ static uint32_t GetColorFromJs(NativeEngine& engine, NativeObject* jsObject, } WLOGFI("origin color: %{public}s", colorStr.c_str()); std::string color = colorStr.substr(1); - if (colorStr.length() == RGB_LENGTH) { - colorStr = "FF" + colorStr; // ARGB + if (color.length() == RGB_LENGTH) { + color = "FF" + color; // ARGB } std::stringstream ss; uint32_t hexColor;