Don't initialize/free if we can't.

This commit is contained in:
Nolan Darilek 2020-01-09 15:54:05 -06:00
parent 3b067faecd
commit c4646c4b26

4
TTS.gd
View File

@ -6,6 +6,8 @@ var TTS
var tts = null var tts = null
func _ready(): func _ready():
if not TTS:
return
if not OS.has_feature('JavaScript') and not Engine.has_singleton("AndroidTTS"): if not OS.has_feature('JavaScript') and not Engine.has_singleton("AndroidTTS"):
TTS = preload("godot-tts.gdns") TTS = preload("godot-tts.gdns")
if OS.has_feature('JavaScript'): if OS.has_feature('JavaScript'):
@ -77,4 +79,6 @@ func singular_or_plural(count, singular, plural):
return plural return plural
func _exit_tree(): func _exit_tree():
if not tts or not TTS:
return
tts.free() tts.free()