Condition ' connection.is_null() ' is true. Condition ' !breaked ' is true.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Kerbi

My game has a timer in it that counts down 3 seconds. At the end of the timer some objects are either removed added or both. Generally, there is not a problem with this. However, I also have a save and load function built in as well. The save is fairly straight forward saving all variables from various scenes needed to continue the game when loading. The load would load the variables and then initiate the timer above. Problem occurs somehow after the load has completed and the timer does the first 2 seconds but not the 3rd second; the game then totally crashes/stops running and dies.
From the debugger I am seeing these errors:
editor/script_editor_debugger.cpp:229 - Condition ’ connection.is_null() ’ is true.
editor/script_editor_debugger.cpp:239 - Condition ’ !breaked ’ is true.
Is there any information/documentation explaining what these errors mean?
Godot Engine v3.0.6.stable.official.8314054

I don’t really know what’s happening here. Maybe a piece of code that coincides with the timer hasn’t been loaded yet? A Node, perhaps?

Ertain | 2019-01-18 19:07

This is code for the timeout :

func _on_CountDownStart_timeout():
	var temp = int($CountDownStart/Background/Count.text) - 1
	if temp == 0:
		$CountDownStart/Background/Count.visible = false
		$CountDownStart/Background.visible = false
		if isRoundContinue:
		else :

The first print statement in the function only prints twice and not a third time as expected(after loading save data). It is almost as if the function is never called the third time.

Kerbi | 2019-01-18 20:26

Is that how the code looks, indentations and all?

Ertain | 2019-01-20 03:51

The first indent level for the function was missing, I just updated the indentation to match what it looks in the actual project.

Kerbi | 2019-01-21 18:43

This may be a long shot, but what if the temp doesn’t reach 0? What if it reaches some other number, like -1? Also, that part about casting Count to an integer just seems out of place. I mean, if Count was a floating point number before the loop, it then becomes an integer after the loop, thus losing precision.

Ertain | 2019-01-21 19:05

Yes it is not counting down to 0. I tested this by placing a print statement at the end of the function to print ‘temp’. In situations when the crash occurs it counts down to 1 and that’s it (does become less than 0). The ‘Hello’ output is not printed again which seems to indicate that the function is not even called that last time. Note the ‘temp’ variable is getting its value from a ‘Label’ which has the static value of ‘3’ and no where else in the project is this value being changed.
I have been doing some further tests and have been able to isolate more conditions that occur prior to the crash. However, it still does not explain how these conditions should affect this timer.
Is there any documentation on errors generated by the API? I can’t seem to locate any documentation on these errors or what they mean.

Kerbi | 2019-01-22 02:44

Don’t know much about the errors returned by the editor. Maybe the signal timer became null? What you could also do is walk through the execution of the code. You could set a breakpoint in the if loop, and look at the state of the variables in the Debugger pane, to see what’s going on.

Ertain | 2019-01-22 03:20

I found the issue and was able to rectify it. It actually was not related to the timer. I will try summarize.
My main scene has a variable number of buttons at any one point in time. As you might have guessed from the code above the timer controls some rounds within the game. Each time the round changes, buttons from the previous round need to be removed so that new buttons can be added. This was done via a flag. However, it seems that the flag was not being updated properly for scenarios (the save/load) and therefore my cleanup function was not clearing up the unwanted buttons (call_deferred(“free”)). Once I rectified this the previous issue no longer occurred.
I think since these Button objects were not being cleared up this may have caused the error when more Button objects were being loaded. It was a silly mistake on my part here and I was looking at it all wrong.
@Ertain many thanks!

Kerbi | 2019-01-23 02:02

Glad to be of service.

Ertain | 2019-01-23 13:35