If I pass an empty string ("") as an argument to a Chora function then in the generated C code it gets translated into 0 rather than a valid pointer. If my function then passes this "string" to EwStringToAnsi in a native call then I get a segfault (because there is no null-pointer check in EwStringToAnsi, the pointer just gets dereferenced).
Normal case:
T30DayData[i] = LoadGraphData(json_handle, "%a", i);
// gets translated to this generated code which passes a valid pointer:
_this->T30DayData[ i ] = ApplicationDeviceClass_LoadGraphData( _this, json_handle, EwLoadString( &_Const002B ), i );
Broken case:
T30DayData[i] = LoadGraphData(json_handle, "", i);
// gets translated in this, passes a null pointer:
_this->T30DayData[ i ] = ApplicationDeviceClass_LoadGraphData( _this, json_handle, 0, i );
Am I doing something wrong?
I've worked around the problem now, but thought I should post this here as it took me a while to track this down and someone else might find something similar.