Android build crashing when fetching data from file (Godot 2.1.4)

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Daimler
:warning: Old Version Published before Godot 3 was released.

I’m trying to implement a local highscore system to my game. The system works fine in the editor and in a X11 build, but on Android it crashes in get_pascal_string(), I believe. Strange thing is, if I wait a bit (do a print, for example) the system works fine. The file is open by the time get_pascal_string() is performed. Adb logcat gives to following error message.

12-14 13:10:31.100 28663 28681 I godot   : HighscoreManager - get_highscores
12-14 13:10:31.101 28663 28681 I godot   : File found
12-14 13:10:31.101 28663 28681 I godot   : ERROR: resize: Condition ' p_size < 0 ' is true. returned: ERR_INVALID_PARAMETER
12-14 13:10:31.101 28663 28681 I godot   :    At: core/vector.h:260.
func get_highscores():
	var highscores_file = File.new()
	var highscores_arr = Array()
	if(highscores_file.file_exists(highscores_location)):
		print("File found")
		highscores_file.open(highscores_location, File.READ)
		while(highscores_file.eof_reached() == false):
			#print("Reading file") # HACK: Android crashed if print not here
			var username = highscores_file.get_pascal_string()
			var score = highscores_file.get_16()
			if(username != ""):
				highscores_arr.append([username, score])
		highscores_file.close()
	else:
		print("File doesn't exist")
	return highscores_arr