LoadByteArray and others fail if null

BlitzMax Forums/BlitzMax Programming/LoadByteArray and others fail if null

Im not sure this is a bug, but shouldnt SaveString / LoadByteArray and SaveByteArray
check if the stream is Null before trying to access it?
In case it was unabe to open the stream for reading/writing.

Possibly but it's easy to check yourself and you can override (is that the right term?) or extend the function
in your own module.

Hi,

These functions will throw an exception if they fail, which you can trap with Try/Catch.

Changing them to check for a null stream means they would still have to do something to indicate an error - but what?

For example, how would you indicate that LoadByteArray failed? Returning an empty array wouldn't work as this could also be a successful result. You could change to a 'Var' parameter setup, but that gets pretty ugly.

Best move really is to make sure files exist before reading them.