Skip to content

Commit 5ab172e

Browse files
jasnellevanlucas
authored andcommitted
src: fix use of uninitialized variable
Variable was uninitialized in 72547fe Initialize the variable and add a static_check PR-URL: #9281 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
1 parent 6c9e4fd commit 5ab172e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/node_i18n.cc

+3-1
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,9 @@ static void GetStringWidth(const FunctionCallbackInfo<Value>& args) {
586586
TwoByteValue value(env->isolate(), args[0]);
587587
// reinterpret_cast is required by windows to compile
588588
UChar* str = reinterpret_cast<UChar*>(*value);
589-
UChar32 c;
589+
static_assert(sizeof(*str) == sizeof(**value),
590+
"sizeof(*str) == sizeof(**value)");
591+
UChar32 c = 0;
590592
UChar32 p;
591593
size_t n = 0;
592594
uint32_t width = 0;

0 commit comments

Comments
 (0)