Diddy Crash when lost focus

Monkey Forums/Monkey Programming/Diddy Crash when lost focus

Fryman(Posted 2015) [#1]
I noticed in my current project it was crashing when it loses focus (alt tab change tabs etc)
in the HTML5 target, I dont currently have the other targets setup to test
The error posted is:
Monkey Runtime Error : Null object access
C:/Users/Adam/Desktop/jentos_v1.1/MonkeyXPro82b/modules/diddy/framework.monkey<552>
C:/Users/Adam/Desktop/jentos_v1.1/MonkeyXPro82b/modules/mojo/app.monkey<99>



You can replicate the crash with this code:

Import mojo
Import diddy


Function Main()

	New Game

End

Class Game Extends DiddyApp

	Method OnCreate()
	SetUpdateRate(1)
	End Method
	
	Method OnRender()
	Cls
	End Method
	
	Method OnUpdate()
	Print "Hi"
	End Method
	

End



Samah(Posted 2015) [#2]
The OnCreate, OnRender, and OnUpdate methods in the DiddyApp class are not intended to be overridden. You should be using subclasses of Screen for that.
If for some reason you do want to override them, you need to call Super.OnCreate/OnRender/OnUpdate at some point in your implementation.


Fryman(Posted 2015) [#3]
Thank you again