1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-25 08:13:45 +00:00

Fix bug where pressing ENTER in UI would cause song to try to preview. Fix bug where trying to preview a newly created song would crash.

This commit is contained in:
EliteMasterEric 2023-08-04 11:18:00 -04:00
parent 13671cf290
commit 4852515c42
2 changed files with 8 additions and 4 deletions

View file

@ -39,7 +39,11 @@ class Song implements IPlayStateScriptedClass
var difficultyIds:Array<String>;
public function new(id:String)
/**
* @param id The ID of the song to load.
* @param ignoreErrors If false, an exception will be thrown if the song data could not be loaded.
*/
public function new(id:String, ignoreErrors:Bool = false)
{
this.songId = id;
@ -48,7 +52,7 @@ class Song implements IPlayStateScriptedClass
difficulties = new Map<String, SongDifficulty>();
_metadata = SongDataParser.loadSongMetadata(songId);
if (_metadata == null || _metadata.length == 0)
if (_metadata == null || _metadata.length == 0 && !ignoreErrors)
{
throw 'Could not find song data for songId: $songId';
}
@ -60,7 +64,7 @@ class Song implements IPlayStateScriptedClass
public static function buildRaw(songId:String, metadata:Array<SongMetadata>, variations:Array<String>, charts:Map<String, SongChartData>,
?validScore:Bool = false):Song
{
var result:Song = new Song(songId);
var result:Song = new Song(songId, true);
result._metadata.clear();
for (meta in metadata)

View file

@ -2761,7 +2761,7 @@ class ChartEditorState extends HaxeUIState
*/
function handleTestKeybinds():Void
{
if (FlxG.keys.justPressed.ENTER)
if (!isHaxeUIDialogOpen && FlxG.keys.justPressed.ENTER)
{
var minimal = FlxG.keys.pressed.SHIFT;
testSongInPlayState(minimal);