forked from Mirrors/openclonk
UseControl: Prevent possible call on null object
This usually happens in the following case from ClonkControl.ocd/Script.c: // Release commands are always forwarded even if contents is 0, in case we // need to cancel use of an object that left inventory if (contents || (status == CONS_Up && GetUsedObject())) { if (ControlUse2Script(ctrl, x, y, strength, repeat, status, contents)) return true; } It could also be necessary that, instead of contents, either "this", or GetUsedObject() should be passed. Not sure which one was intended.install-platforms
parent
2553f5a388
commit
6cb154fabd
|
@ -317,7 +317,12 @@ func StopUseControl(int x, int y, object obj, bool cancel)
|
|||
stop = "Cancel";
|
||||
|
||||
// ControlUseStop, ControlUseAltStop, ContainedUseAltStop, ContainedUseCancel, etc...
|
||||
var handled = obj->Call(GetUseCallString(stop), this, x, y);
|
||||
var handled = false;
|
||||
if (obj)
|
||||
{
|
||||
handled = obj->Call(GetUseCallString(stop), this, x, y);
|
||||
}
|
||||
|
||||
if (obj == GetUsedObject())
|
||||
{
|
||||
// if ControlUseStop returned -1, the current object is kept as "used object"
|
||||
|
|
Loading…
Reference in New Issue