Skip to content

Commit f0aa8cf

Browse files
author
Roberto De Ioris
committed
check for outer when dealing with components
1 parent 525b26e commit f0aa8cf

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Source/UnrealEnginePython/Private/UEPyInput.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,10 @@ PyObject *py_ue_bind_key(ue_PyUObject *self, PyObject * args) {
441441
input = ((AActor *)self->ue_object)->InputComponent;
442442
}
443443
else if (self->ue_object->IsA<UActorComponent>()) {
444-
input = ((UActorComponent *)self->ue_object)->GetOwner()->InputComponent;
444+
UActorComponent *component = (UActorComponent *)self->ue_object;
445+
if (!component->GetOwner())
446+
return PyErr_Format(PyExc_Exception, "component is still not mapped to an Actor");
447+
input = component->GetOwner()->InputComponent;
445448
}
446449
else {
447450
return PyErr_Format(PyExc_Exception, "uobject is not an actor or a component");

0 commit comments

Comments
 (0)