# NullReferenceException when quitting game

**URL:** https://discussions.unity.com/t/nullreferenceexception-when-quitting-game/929426
**Category:** Localization
**Tags:** Localization, Bug
**Created:** [September 18, 2023, 1:57pm UTC](https://discussions.unity.com/t/nullreferenceexception-when-quitting-game/929426 "2023-09-18T13:57:25Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![\_eternal](https://avatars.discourse-cdn.com/v4/letter/_/ea5d25/32.png) [@\_eternal](https://discussions.unity.com/u/_eternal)
#### Post date: [September 18, 2023, 1:57pm UTC](https://discussions.unity.com/t/nullreferenceexception-when-quitting-game/929426/1 "2023-09-18T13:57:25Z")

</div>

In build, when I exit the game with Application.Quit, I get the following error:

```csharp
NullReferenceException
  at (wrapper managed-to-native) UnityEngine.Object.GetName(UnityEngine.Object)
  at UnityEngine.Object.get_name () [0x00001] in <3b8612fb27654522b26040b8324dc42e>:0
  at UnityEngine.Localization.Tables.LocalizationTable.VerifySharedTableDataIsNotNull () [0x0000e] in <d359aa6c7074454588d37ce916a712fa>:0
  at UnityEngine.Localization.Tables.LocalizationTable.get_TableCollectionName () [0x00000] in <d359aa6c7074454588d37ce916a712fa>:0
  at UnityEngine.Localization.Tables.DetailedLocalizationTable`1[TEntry].ToString () [0x00000] in <d359aa6c7074454588d37ce916a712fa>:0
  at UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1[TObject].ToString () [0x00049] in <02178ad6f35243cd906527868201b93f>:0
  at UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1[TObject].get_DebugName () [0x00000] in <02178ad6f35243cd906527868201b93f>:0
  at UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1[TObject].UnityEngine.ResourceManagement.AsyncOperations.IAsyncOperation.get_DebugName () [0x00000] in <02178ad6f35243cd906527868201b93f>:0
  at UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.get_DebugName () [0x00014] in <02178ad6f35243cd906527868201b93f>:0
  at UnityEngine.AddressableAssets.Utility.ResourceManagerDiagnostics.CalculateHashCode (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle handle) [0x00000] in <edb9552988c045088c451dad1ed4baa6>:0
  at UnityEngine.AddressableAssets.Utility.ResourceManagerDiagnostics.OnResourceManagerDiagnosticEvent (UnityEngine.ResourceManagement.ResourceManager+DiagnosticEventContext eventContext) [0x00008] in <edb9552988c045088c451dad1ed4baa6>:0
  at UnityEngine.ResourceManagement.ResourceManager.PostDiagnosticEvent (UnityEngine.ResourceManagement.ResourceManager+DiagnosticEventContext context) [0x0000a] in <02178ad6f35243cd906527868201b93f>:0
  at UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1[TObject].DecrementReferenceCount () [0x00057] in <02178ad6f35243cd906527868201b93f>:0
  at UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1[TObject].UnityEngine.ResourceManagement.AsyncOperations.IAsyncOperation.DecrementReferenceCount () [0x00000] in <02178ad6f35243cd906527868201b93f>:0
  at UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.Release () [0x00006] in <02178ad6f35243cd906527868201b93f>:0
  at UnityEngine.ResourceManagement.ResourceManager.Release (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle handle) [0x00000] in <02178ad6f35243cd906527868201b93f>:0
  at UnityEngine.AddressableAssets.AddressablesImpl.Release (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle handle) [0x00000] in <edb9552988c045088c451dad1ed4baa6>:0
  at UnityEngine.AddressableAssets.Addressables.Release (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle handle) [0x00005] in <edb9552988c045088c451dad1ed4baa6>:0
  at UnityEngine.Localization.AddressablesInterface.ReleaseInternal (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle handle) [0x00000] in <d359aa6c7074454588d37ce916a712fa>:0
  at UnityEngine.Localization.AddressablesInterface.SafeRelease (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle handle) [0x0000e] in <d359aa6c7074454588d37ce916a712fa>:0
  at UnityEngine.Localization.Operations.GetTableEntryOperation`2[TTable,TEntry].Destroy () [0x0000b] in <d359aa6c7074454588d37ce916a712fa>:0
  at UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1[TObject].DecrementReferenceCount () [0x000bf] in <02178ad6f35243cd906527868201b93f>:0
  at UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1[TObject].UnityEngine.ResourceManagement.AsyncOperations.IAsyncOperation.DecrementReferenceCount () [0x00000] in <02178ad6f35243cd906527868201b93f>:0
  at UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.Release () [0x00006] in <02178ad6f35243cd906527868201b93f>:0
  at UnityEngine.ResourceManagement.ResourceManager.Release (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle handle) [0x00000] in <02178ad6f35243cd906527868201b93f>:0
  at UnityEngine.AddressableAssets.AddressablesImpl.Release (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle handle) [0x00000] in <edb9552988c045088c451dad1ed4baa6>:0
  at UnityEngine.AddressableAssets.Addressables.Release (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle handle) [0x00005] in <edb9552988c045088c451dad1ed4baa6>:0
  at UnityEngine.Localization.AddressablesInterface.ReleaseInternal (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle handle) [0x00000] in <d359aa6c7074454588d37ce916a712fa>:0
  at UnityEngine.Localization.AddressablesInterface.Release (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle handle) [0x00005] in <d359aa6c7074454588d37ce916a712fa>:0
  at UnityEngine.Localization.LocalizedString.ClearLoadingOperation () [0x0003f] in <d359aa6c7074454588d37ce916a712fa>:0
  at UnityEngine.Localization.LocalizedString.remove_StringChanged (UnityEngine.Localization.LocalizedString+ChangeHandler value) [0x00024] in <d359aa6c7074454588d37ce916a712fa>:0
  at UnityEngine.Localization.Components.LocalizeStringEvent.ClearChangeHandler () [0x00006] in <d359aa6c7074454588d37ce916a712fa>:0
  at UnityEngine.Localization.Components.LocalizeStringEvent.OnDisable () [0x00000] in <d359aa6c7074454588d37ce916a712fa>:0

```

There are a few more like this, probably coming from any LocalizeStringEvent that was active in the scene at the time of closing.

I’m seeing another (possibly related?) error coming from OnDestroy as well.

```csharp
Exception: Cannot decrement reference count for operation GetTableEntryOperation`2, Current Locale: English (en), Selected Locale: English (en), Table: TableReference(9eba0192-cf20-ef14-d8a1-b29e39e7f84a - Pause Menu), Entry: TableEntryReference(686713618432), Fallback: False because it is already 0
  at UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1[TObject].DecrementReferenceCount () [0x00014] in <02178ad6f35243cd906527868201b93f>:0
  at UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1[TObject].UnityEngine.ResourceManagement.AsyncOperations.IAsyncOperation.DecrementReferenceCount () [0x00000] in <02178ad6f35243cd906527868201b93f>:0
  at UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.Release () [0x00006] in <02178ad6f35243cd906527868201b93f>:0
  at UnityEngine.ResourceManagement.ResourceManager.Release (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle handle) [0x00000] in <02178ad6f35243cd906527868201b93f>:0
  at UnityEngine.AddressableAssets.AddressablesImpl.Release (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle handle) [0x00000] in <edb9552988c045088c451dad1ed4baa6>:0
  at UnityEngine.AddressableAssets.Addressables.Release (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle handle) [0x00005] in <edb9552988c045088c451dad1ed4baa6>:0
  at UnityEngine.Localization.AddressablesInterface.ReleaseInternal (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle handle) [0x00000] in <d359aa6c7074454588d37ce916a712fa>:0
  at UnityEngine.Localization.AddressablesInterface.Release (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle handle) [0x00005] in <d359aa6c7074454588d37ce916a712fa>:0
  at UnityEngine.Localization.LocalizedString.ClearLoadingOperation () [0x0003f] in <d359aa6c7074454588d37ce916a712fa>:0
  at UnityEngine.Localization.LocalizedString.remove_StringChanged (UnityEngine.Localization.LocalizedString+ChangeHandler value) [0x00024] in <d359aa6c7074454588d37ce916a712fa>:0
  at UnityEngine.Localization.Components.LocalizeStringEvent.ClearChangeHandler () [0x00006] in <d359aa6c7074454588d37ce916a712fa>:0
  at UnityEngine.Localization.Components.LocalizeStringEvent.OnDestroy () [0x00000] in <d359aa6c7074454588d37ce916a712fa>:0

```

Any thoughts on this? I noticed that the game crashed after quitting, but I think that might have been due to something else. Still, would be nice to clean up the error logs, even if doesn’t affect the user because the game is already closed.

Unity 2022.3.6 / Localization 1.4.4.

---

<div class="post-metadata">

### Author: ![karl\_jones](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/karl_jones/32/83270_2.png) [@karl\_jones](https://discussions.unity.com/u/karl_jones)
#### Post date: [September 18, 2023, 2:49pm UTC](https://discussions.unity.com/t/nullreferenceexception-when-quitting-game/929426/2 "2023-09-18T14:49:43Z")

</div>

Hi,

Could you please file a bug report so we can look into it?

> **[Unity QA: Building quality with passion](https://unity.com/releases/editor/qa#bug-reporting)**
>
> Unity QA provides building tools, frameworks and test suites for both end-users and corporate partners.

---

<div class="post-metadata">

### Author: ![\_eternal](https://avatars.discourse-cdn.com/v4/letter/_/ea5d25/32.png) [@\_eternal](https://discussions.unity.com/u/_eternal)
#### Post date: [September 19, 2023, 7:10pm UTC](https://discussions.unity.com/t/nullreferenceexception-when-quitting-game/929426/3 "2023-09-19T19:10:24Z")

</div>

All right, bug report is available at IN-55170.

---

<div class="post-metadata">

### Author: ![\_eternal](https://avatars.discourse-cdn.com/v4/letter/_/ea5d25/32.png) [@\_eternal](https://discussions.unity.com/u/_eternal)
#### Post date: [September 26, 2023, 4:26am UTC](https://discussions.unity.com/t/nullreferenceexception-when-quitting-game/929426/4 "2023-09-26T04:26:03Z")

</div>

Okay, so they confirmed the bug: [Unity Issue Tracker - Crash at &quot;UnityEngine.Object:FindObjectsOfType&quot; when quitting the Player](https://issuetracker.unity3d.com/issues/crash-at-unityengine-dot-object-findobjectsoftype-when-quitting-the-player)

In the meantime though, is there any way to fix this on my end? I tried deleting the Addressables cache and doing a new build. It’s still crashing on quit. The Addressables Analyzer doesn’t show any fixable problems, either.
