@@ -1440,7 +1440,11 @@ UClass *unreal_engine_new_uclass(char *name, UClass *outer_parent)
14401440 new_object->AssembleReferenceTokenStream ();
14411441
14421442#if WITH_EDITOR
1443- FBlueprintActionDatabase::Get ().RefreshClassActions (new_object);
1443+ // this is required for avoiding startup crashes #405
1444+ if (GEditor)
1445+ {
1446+ FBlueprintActionDatabase::Get ().RefreshClassActions (new_object);
1447+ }
14441448#endif
14451449
14461450 return new_object;
@@ -2439,17 +2443,17 @@ bool ue_py_convert_pyobject(PyObject *py_obj, UProperty *prop, uint8 *buffer, in
24392443 {
24402444
24412445 casted_prop_weak_object->SetPropertyValue_InContainer (buffer, FWeakObjectPtr (ue_obj->ue_object ), index);
2442-
2446+
24432447 return true ;
24442448 }
24452449 else if (auto casted_prop_base = Cast<UObjectPropertyBase>(prop))
24462450 {
24472451 // ensure the object type is correct, otherwise crash could happen (soon or later)
24482452 if (!ue_obj->ue_object ->IsA (casted_prop_base->PropertyClass ))
24492453 return false ;
2450-
2454+
24512455 casted_prop_base->SetObjectPropertyValue_InContainer (buffer, ue_obj->ue_object , index);
2452-
2456+
24532457 return true ;
24542458 }
24552459
@@ -2464,28 +2468,28 @@ bool ue_py_convert_pyobject(PyObject *py_obj, UProperty *prop, uint8 *buffer, in
24642468 // ensure the object type is correct, otherwise crash could happen (soon or later)
24652469 if (!ue_obj->ue_object ->IsA (casted_prop->PropertyClass ))
24662470 return false ;
2467-
2471+
24682472 casted_prop->SetObjectPropertyValue_InContainer (buffer, ue_obj->ue_object , index);
2469-
2473+
24702474 return true ;
24712475 }
24722476 else if (auto casted_prop_soft_object = Cast<USoftObjectProperty>(prop))
24732477 {
24742478 if (!ue_obj->ue_object ->IsA (casted_prop_soft_object->PropertyClass ))
24752479 return false ;
2476-
2480+
24772481 casted_prop_soft_object->SetPropertyValue_InContainer (buffer, FSoftObjectPtr (ue_obj->ue_object ), index);
2478-
2482+
24792483 return true ;
24802484 }
24812485 else if (auto casted_prop_interface = Cast<UInterfaceProperty>(prop))
24822486 {
24832487 // ensure the object type is correct, otherwise crash could happen (soon or later)
24842488 if (!ue_obj->ue_object ->GetClass ()->ImplementsInterface (casted_prop_interface->InterfaceClass ))
24852489 return false ;
2486-
2490+
24872491 casted_prop_interface->SetPropertyValue_InContainer (buffer, FScriptInterface (ue_obj->ue_object ), index);
2488-
2492+
24892493 return true ;
24902494 }
24912495 }
@@ -2497,17 +2501,17 @@ bool ue_py_convert_pyobject(PyObject *py_obj, UProperty *prop, uint8 *buffer, in
24972501 auto casted_prop_class = Cast<UClassProperty>(prop);
24982502 if (casted_prop_class)
24992503 {
2500-
2504+
25012505 casted_prop_class->SetPropertyValue_InContainer (buffer, nullptr , index);
2502-
2506+
25032507 return true ;
25042508 }
25052509 auto casted_prop = Cast<UObjectPropertyBase>(prop);
25062510 if (casted_prop)
25072511 {
2508-
2512+
25092513 casted_prop->SetObjectPropertyValue_InContainer (buffer, nullptr , index);
2510-
2514+
25112515 return true ;
25122516 }
25132517 return false ;
@@ -2679,8 +2683,8 @@ PyObject *py_ue_ufunction_call(UFunction *u_function, UObject *u_obj, PyObject *
26792683 return PyErr_Format (PyExc_Exception, " UFunction has no SuperFunction" );
26802684 }
26812685 u_function = u_function->GetSuperFunction ();
2682- }
26832686 }
2687+ }
26842688
26852689 // NOTE: u_function->PropertiesSize maps to local variable uproperties + ufunction paramaters uproperties
26862690 uint8 *buffer = (uint8 *)FMemory_Alloca (u_function->ParmsSize );
@@ -2713,8 +2717,8 @@ PyObject *py_ue_ufunction_call(UFunction *u_function, UObject *u_obj, PyObject *
27132717#endif
27142718 }
27152719#endif
2720+ }
27162721 }
2717- }
27182722
27192723
27202724 Py_ssize_t tuple_len = PyTuple_Size (args);
@@ -3146,9 +3150,9 @@ UFunction *unreal_engine_add_function(UClass *u_class, char *name, PyObject *py_
31463150 if (p->HasAnyPropertyFlags (CPF_ReturnParm))
31473151 {
31483152 function->ReturnValueOffset = p->GetOffset_ForUFunction ();
3153+ }
31493154 }
31503155 }
3151- }
31523156
31533157 if (parent_function)
31543158 {
@@ -3202,11 +3206,15 @@ UFunction *unreal_engine_add_function(UClass *u_class, char *name, PyObject *py_
32023206#endif
32033207
32043208#if WITH_EDITOR
3205- FBlueprintActionDatabase::Get ().RefreshClassActions (u_class);
3209+ // this is required for avoiding startup crashes #405
3210+ if (GEditor)
3211+ {
3212+ FBlueprintActionDatabase::Get ().RefreshClassActions (u_class);
3213+ }
32063214#endif
32073215
32083216 return function;
3209- }
3217+ }
32103218
32113219FGuid *ue_py_check_fguid (PyObject *py_obj)
32123220{
0 commit comments