Changeset - r22901:444c689660a1
[Not reviewed]
master
0 1 0
Jonathan G Rennison - 6 years ago 2018-06-06 07:22:58
j.g.rennison@gmail.com
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.
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/misc_gui.cpp
Show inline comments
 
@@ -656,7 +656,7 @@ struct TooltipsWindow : public Window
 
		this->string_id = str;
 
		assert_compile(sizeof(this->params[0]) == sizeof(params[0]));
 
		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->close_cond = close_tooltip;
 

	
0 comments (0 inline, 0 general)