mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Avoid call to memcpy using null pointer in TooltipsWindow constructor
Strictly speaking, calling memcpy with src as a nullptr is undefined behaviour and the optimiser is entitled to delete any null ptr checks which occur afterwards. This removes the warning emitted by UndefinedBehaviorSantizer.pull/6821/head
parent
cd966f3810
commit
71450881fc
|
@ -656,7 +656,7 @@ struct TooltipsWindow : public Window
|
||||||
this->string_id = str;
|
this->string_id = str;
|
||||||
assert_compile(sizeof(this->params[0]) == sizeof(params[0]));
|
assert_compile(sizeof(this->params[0]) == sizeof(params[0]));
|
||||||
assert(paramcount <= lengthof(this->params));
|
assert(paramcount <= lengthof(this->params));
|
||||||
memcpy(this->params, params, sizeof(this->params[0]) * paramcount);
|
if (paramcount > 0) memcpy(this->params, params, sizeof(this->params[0]) * paramcount);
|
||||||
this->paramcount = paramcount;
|
this->paramcount = paramcount;
|
||||||
this->close_cond = close_tooltip;
|
this->close_cond = close_tooltip;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue