googleanalytics / google-analytics-plugin-for-unity

Google Analytics plugin for the Unity game creation system
Apache License 2.0
388 stars 140 forks source link

V4 Not sending data due null exception in Handle WWW #160

Open ghost opened 7 years ago

ghost commented 7 years ago

My V4 plugin constantly throws hundreds of exceptions:

NullReferenceException: Object reference not set to an instance of an object GoogleAnalyticsMPV3+c__Iterator0.MoveNext () (at Assets/Plugins/GoogleAnalyticsV4/GoogleAnalyticsMPV3.cs:156) UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)

So the line: if (request.responseHeaders.ContainsKey("STATUS"))

throws an exception, because the response headers is null.

Tried with Unity 5.5 and 2017.1.

4026 commented 6 years ago

Yeah, I'm having the same issue in 2017.2. It looks like it happens any time the WWW request object comes back with an error response (reproducible by just disabling your network connection, which causes a "destination unreachable" error).