From d38323ab5553d09ff060f8c65c15d7aad88f4446 Mon Sep 17 00:00:00 2001 From: Jan200101 Date: Fri, 5 Feb 2021 13:14:28 +0100 Subject: [PATCH] check if newgroups api key actually exists before creating core --- source/NGio.hx | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/source/NGio.hx b/source/NGio.hx index 96ced6257..0c2631b86 100644 --- a/source/NGio.hx +++ b/source/NGio.hx @@ -35,19 +35,22 @@ class NGio trace('INIT NOLOGIN'); GAME_VER = "v" + Application.current.meta.get('version'); - NG.create(api); - - new FlxTimer().start(2, function(tmr:FlxTimer) + if (api.length != 0) { - var call = NG.core.calls.app.getCurrentVersion(GAME_VER).addDataHandler(function(response:Response) - { - GAME_VER = response.result.data.current_version; - trace('CURRENT NG VERSION: ' + GAME_VER); - gotOnlineVer = true; - }); + NG.create(api); - call.send(); - }); + new FlxTimer().start(2, function(tmr:FlxTimer) + { + var call = NG.core.calls.app.getCurrentVersion(GAME_VER).addDataHandler(function(response:Response) + { + GAME_VER = response.result.data.current_version; + trace('CURRENT NG VERSION: ' + GAME_VER); + gotOnlineVer = true; + }); + + call.send(); + }); + } } public function new(api:String, encKey:String, ?sessionId:String)