quixe
quixe copied to clipboard
Possible compile_string() bug
Described in thread: https://intfiction.org/t/help-fixing-everybody-dies-so-its-playable-online/51346
When iosys is zero, printing a string should silently do nothing. Instead it maybe generates a Glk "stream not set" error?
A couple of places seem to generate glk_put_jstring() calls without checking iosys:
oputil_flush_string() stream_string() accel_func_map error cases
Now I'm thinking that it's not compile_string() after all. Looks like msww was correct in the thread that stream_string() should check iosys.
The problem turned out to be more subtle than either of us... I think it's fixed now.
accel_func_map errors now only print if iosys is 2. (I have made the same change in glulxe.)
In oputil_flush_string() and stream_string(), we don't need to check iosys. We're printing text buffered for the Glk stream. But we do need to check if the buffered text is empty. The compile_string() layer returns "" if nothing was printed to Glk at all, and we need to not crash in that case.