I have just discovered a bug in our customised Wynsure development.
In eWAM there is a preinitialised variable (_Result) for the return value of a function. The type of this value depends on the return type of the function. The problem starts when you want to return a tWFDate, and trying to catch the null (nil) case, something like this:
function ThisisTheDate return tWFDate
if _Result.type.isNull(@_Result)
;This code actually never will run
endif
endFunc
As you can see there is the Null check for the result. The problem is that Null check for tWFdate type only checks if the pointer points to null, not the value of the pointer. Since the _Result is already initialised, it will point somewhere, so it’s not null.
Conclusion: Never trust automatically preinitialised variables, try to use them in a “lazy way”: give them their value before returning from the function.