Skip to content

Commit df08dea

Browse files
committed
misc get atr guards
1 parent 44d03e3 commit df08dea

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

‎Source/UnrealEnginePython/Private/UEPyEngine.cpp‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,7 @@ PyObject *py_unreal_engine_all_classes(PyObject * self, PyObject * args) {
466466
}
467467

468468
PyObject *py_unreal_engine_create_and_dispatch_when_ready(PyObject * self, PyObject * args) {
469+
469470
PyObject *py_callable = nullptr;
470471
PyObject *py_params = nullptr;
471472

@@ -509,6 +510,8 @@ PyObject *py_unreal_engine_create_and_dispatch_when_ready(PyObject * self, PyObj
509510

510511
const PyObject* py_callable_s = py_callable;
511512
const PyObject* py_params_s = py_params;
513+
514+
512515
FGraphEventRef task = FFunctionGraphTask::CreateAndDispatchWhenReady([&, py_callable_s, py_params_s]() {
513516
//UE_LOG(LogPython, Log, TEXT("In task graph, are in game thread? %d"), IsInGameThread());
514517

@@ -548,7 +551,7 @@ PyObject *py_unreal_engine_create_and_dispatch_when_ready(PyObject * self, PyObj
548551
}
549552
Py_DECREF(py_callable_s);
550553
}, TStatId(), nullptr, ENamedThreads::GameThread);
551-
554+
552555
Py_INCREF(Py_None);
553556
return Py_None;
554557
}

‎Source/UnrealEnginePython/Private/UEPyModule.cpp‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,9 +649,17 @@ static PyObject *ue_PyUObject_getattro(ue_PyUObject *self, PyObject *attr_name)
649649
PyObject *ret = PyObject_GenericGetAttr((PyObject *)self, attr_name);
650650
if (!ret) {
651651
if (PyUnicodeOrString_Check(attr_name)) {
652+
//Valid uobject?
653+
if (!self->ue_object->IsValidLowLevel())
654+
{
655+
UE_LOG(LogPython, Warning, TEXT("Invalid ue_PyUObject %p mapped to UObject %p"), self, self->ue_object);
656+
return ret;
657+
}
658+
652659
char *attr = PyUnicode_AsUTF8(attr_name);
653660
// first check for property
654661
UStruct *u_struct = nullptr;
662+
655663
if (self->ue_object->IsA<UStruct>()) {
656664
u_struct = (UStruct *)self->ue_object;
657665
}

0 commit comments

Comments
 (0)