Skip to content

Commit e94c098

Browse files
committed
[CID 16456] libscript: MCScriptEndHandlerInModule(): Unitialized variable.
Even indices are non-negative. 0 is non-negative, so it should be treated as an even index.
1 parent 1a0cefb commit e94c098

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libscript/src/script-builder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1134,7 +1134,7 @@ void MCScriptEndHandlerInModule(MCScriptModuleBuilderRef self)
11341134
t_target_address = self -> instructions[self -> labels[t_operands[t_address_index] - 1] . instruction] . address - t_address;
11351135

11361136
uindex_t t_encoded_target_address;
1137-
if (t_target_address > 0)
1137+
if (t_target_address >= 0)
11381138
t_encoded_target_address = t_target_address * 2;
11391139
else if (t_target_address < 0)
11401140
t_encoded_target_address = (-t_target_address) * 2 + 1;

0 commit comments

Comments
 (0)