From 59a0aa3667345bdc1a7015c548c9350e3497bc30 Mon Sep 17 00:00:00 2001 From: James F McMahon Date: Mon, 23 May 2016 15:21:35 -0500 Subject: [PATCH] Fix null achievement array Need to return if not authenticated, otherwise `mClient.LoadAchievements` will fail with a null achievement array. Also added a null guard around the callback invocation. Full error: ``` NullReferenceException: Object reference not set to an instance of an object GooglePlayGames.PlayGamesPlatform+c__AnonStorey9.<>m__5 (GooglePlayGames.BasicApi.Achievement[] ach) GooglePlayGames.BasicApi.DummyClient.LoadAchievements (System.Action`1 callback) GooglePlayGames.PlayGamesPlatform.LoadAchievements (System.Action`1 callback) UnityEngine.Social.LoadAchievements (System.Action`1 callback) ``` --- .../GooglePlayGames/ISocialPlatform/PlayGamesPlatform.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/PluginDev/Assets/GooglePlayGames/ISocialPlatform/PlayGamesPlatform.cs b/source/PluginDev/Assets/GooglePlayGames/ISocialPlatform/PlayGamesPlatform.cs index 6eaca7813..366623df6 100644 --- a/source/PluginDev/Assets/GooglePlayGames/ISocialPlatform/PlayGamesPlatform.cs +++ b/source/PluginDev/Assets/GooglePlayGames/ISocialPlatform/PlayGamesPlatform.cs @@ -829,7 +829,11 @@ public void LoadAchievementDescriptions(Action callba { GooglePlayGames.OurUtils.Logger.e( "LoadAchievementDescriptions can only be called after authentication."); - callback.Invoke(null); + if (callback != null) + { + callback.Invoke(null); + } + return; } mClient.LoadAchievements(ach =>