Editor crashes on startup if uninitialized UPROPERTY object pointer is used in USTRUCT
If inside a USTRUCT an object pointer is declared as a UPROPERTY like this:
...the editor crashes on startup (assert fails) at the following location:
However, if either the UPROPERTY() is removed, or the pointer is initialized to nullptr inside the struct's constructor, like this:
...the editor starts up.
The log states:
This error is probably related to UE-23056 where the developer notes say 'Improper struct initialization' (which isn't being terribly specific).
I see that not initializing the pointer probably IS an improper initialization, and I get that this probably cannot be caught at compile time. However, it is a very obscure error to me that took some time to track down. Maybe an improved runtime error could be implemented that somehow names the affected struct?
I was digging into this some more today, and noticed that the error message that I was getting does already somewhat hint at where the problem lies. This is the error that I am receiving:
In this case, "Object" may not be the best name for the pointer in the struct. However, the error does indicate that there is a problem with the property named Object. Do you think that needs to be further clarified in this case?
answered Mar 01 '17 at 08:32 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here