- Joined
- Aug 7, 2013
- Messages
- 1,338
Hi,
I have this code below, which didn't behave as expected.
So "e" is some struct, and it has a field "weather" which is of type weathereffect.
The "if" statement above never returns as true, and thus the body doesn't get called. However, I know for a fact that "e.weather" is actually not null. as this code ran correctly before it.
So the weather exists (rays of light over a rect), but for some reason I can only remove the weather when I remove my null safety check.
The above code works, and removes the weather correctly--no crashes either. But that's a contradiction, because it means the weather effect is somehow still null and removing a null handle = crash?
I have this code below, which didn't behave as expected.
JASS:
if e != 0 then and e.weather != null then //this never returns as true
call EnableWeatherEffect(e.weather, false)
So "e" is some struct, and it has a field "weather" which is of type weathereffect.
The "if" statement above never returns as true, and thus the body doesn't get called. However, I know for a fact that "e.weather" is actually not null. as this code ran correctly before it.
JASS:
static method create takes integer effectID returns thistype
local thistype this = thistype.allocate()
set this.weather = AddWeatherEffect(r, effectID)
return this
endmethod
So the weather exists (rays of light over a rect), but for some reason I can only remove the weather when I remove my null safety check.
JASS:
if e != 0 then//and e.weather != null then this works and doesn't crash
call EnableWeatherEffect(e.weather, false
The above code works, and removes the weather correctly--no crashes either. But that's a contradiction, because it means the weather effect is somehow still null and removing a null handle = crash?