CodexLabsLLC / Colosseum

Open source simulator for autonomous robotics built on Unreal Engine with support for Unity
https://codexlabsllc.github.io/Colosseum/
Other
335 stars 105 forks source link

Blocks environment crashing just after Play button is hit: sun_prop in NULL pointer. #59

Open MehmetCagriK opened 1 year ago

MehmetCagriK commented 1 year ago

Bug report

What's the issue you encountered?

After clean build, Blocks environment crashing at the line of Colosseum\Unreal\Environments\Blocks\Plugins\AirSim\Source\SimMode\SimModeBase.cpp line 235;

#if ENGINE_MINOR_VERSION > 24
        FObjectProperty* sun_prop = CastFieldChecked<FObjectProperty>(p);
#else
        FObjectProperty* sun_prop = Cast<FObjectProperty>(p);
#endif

        UObject* sun_obj = sun_prop->GetObjectPropertyValue_InContainer(sky_sphere_);

Settings

How can the issue be reproduced?

Clean build of Airsim and Blocks are enough on Windows 11 with Unreal Engine 5.2. Playing the simulation instantly crashes

Include full error message in text form

Exception thrown: read access violation. sun_prop was nullptr.

What's better than filing an issue? Filing a pull request :).: I would like to create pull request but I am not well versed in Unreal Engine inner workings. My engineer instinct says code block should be modified as below though;

#if ENGINE_MINOR_VERSION > 24
        FObjectProperty* sun_prop = CastFieldChecked<FObjectProperty>(p);
#else
        FObjectProperty* sun_prop = Cast<FObjectProperty>(p);
#endif

        UObject* sun_obj = sun_prop->GetObjectPropertyValue_InContainer(sky_sphere_);

to simply

        FObjectProperty* sun_prop = CastFieldChecked<FObjectProperty>(p);

        UObject* sun_obj = sun_prop->GetObjectPropertyValue_InContainer(sky_sphere_);
MehmetCagriK commented 1 year ago
#if ENGINE_MINOR_VERSION > 24
        FObjectProperty* sun_prop = CastFieldChecked<FObjectProperty>(p);
#else
        FObjectProperty* sun_prop = Cast<FObjectProperty>(p);
#endif

This conditional compilation seems to have remained after 4.25 change in Unreal Engine. If you decide to support Unreal Engine 4 versions, I would suggest checking major version in addition to minor version also, since 5.2 should be greater than 4.27 but just checking minor version seems to be what crashing the execution.