calref / cboe

Classic Blades of Exile

Home Page:http://spiderwebforums.ipbhost.com/index.php?/forum/12-blades-of-exile/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Clicking "Cancel" in Zenity file-picker on Linux causes core dump.

NQNStudios opened this issue · comments

On Linux, if you click "Cancel" from a file picker dialog, you get a crash with a core dump (In the game, and both editors)

It's because here:
https://github.com/calref/cboe/blob/master/src/tools/winutil.linux.cpp#L134

There is no handling for a popen() that doesn't result in success.

I think I can fix this.

A related problem is that the Zenity picker doesn't let you choose a file that doesn't exist yet, so creating a new scenario in the editor is impossible (maybe you could do it by picking a file that DOES exist an overwriting it, but... that would be bad...)

It looks like the API for Windows also expects to return a string no matter what, and doesn't handle for a Cancel. This could definitely explain #268