Can someone tell me what is wrong with this code?

BlitzMax Forums/MaxGUI Module/Can someone tell me what is wrong with this code?

JoJo(Posted 2008) [#1]
I get the error...Unhandled Exception:Attempt to access field or method of Null object

...at SetImageFont. What gives?

Global ffont:TImageFont
Global filename:String

Function btnChangeFont_GA(Button:TGadget) 
			filename = RequestFile("Select Font", "Font Files:ttf", False, "C:\Windows\Fonts\") 
			ffont = LoadImageFont(filename, 48, SMOOTHFONT) 
			SetImageFont(ffont) 
End Function



Brucey(Posted 2008) [#2]
Do you have Graphics enabled yet?

LoadImageFont only works once Graphics have been initialised.


JoJo(Posted 2008) [#3]
I did have it placed before the graphics command.

Thanks!!

Wasted a hour on that one. Man that's frustrating.