Graphics commands without Graphics errors

BlitzMax Forums/BlitzMax Bug Reports/Graphics commands without Graphics errors

EdzUp: no I'm saying that you should check if the Graphics() call succeeded and if not, handle the error!
As the code order is "predefined" at code time, you surely should be able to do guarantee before calling any drawing command, shouldn't you?
Otherwise you have a serious problem with your code, normally called Spaghetti Code

Azathoth: Bad idea. That would mean that EVERY drawing command would need to check if _graphics <> null.
bye performance!

Whats the problem to just do:
Try
  Graphics(width,height,depth)
Catch(e:object)
  runtimeerror("Error found: " + e.toString() )
endtry

' all drawing commands after this point!

The idea is to check if the graphics creation fails, not to check on every draw if the programmer was just to stupid to put a Graphics before calling it.
Thats pure nonsense as the function call order will not change during compilation so you can guarantee that if graphics initialization succeeded -> it will remain working so continue and draw stuff.
If it didn't succeed -> you must handle the error and do not draw anything.
you do not need any further try - catch - endtry for the graphics post that point! Either the graphics context is created or not, point.

I think you all totally missunderstood what I pointed out.
The drawing stuff does not check for consistency <> null anymore, it would be a total performance overkill to do so.