From 7a704edfeb3689508dc439fbbf3c1427ef90cb02 Mon Sep 17 00:00:00 2001 From: Mister_Nebula <41904486+misternebula@users.noreply.github.com> Date: Thu, 30 Jun 2022 16:50:23 +0100 Subject: [PATCH] add fatal error messages for missing files --- QSB/QSBCore.cs | 6 ++++++ QSB/QSBNetworkManager.cs | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/QSB/QSBCore.cs b/QSB/QSBCore.cs index e67c7f79..9dd3efe5 100644 --- a/QSB/QSBCore.cs +++ b/QSB/QSBCore.cs @@ -127,6 +127,12 @@ public class QSBCore : ModBehaviour ConversationAssetBundle = Helper.Assets.LoadBundle("AssetBundles/qsb_conversation"); DebugAssetBundle = Helper.Assets.LoadBundle("AssetBundles/qsb_debug"); + if (NetworkAssetBundle == null || ConversationAssetBundle == null || DebugAssetBundle == null) + { + DebugLog.ToConsole($"FATAL - An assetbundle is missing! Re-install mod or contact devs.", MessageType.Fatal); + return; + } + QSBPatchManager.Init(); DeterministicManager.Init(); QSBLocalization.Init(); diff --git a/QSB/QSBNetworkManager.cs b/QSB/QSBNetworkManager.cs index 66fd895e..acf2cbb2 100644 --- a/QSB/QSBNetworkManager.cs +++ b/QSB/QSBNetworkManager.cs @@ -186,6 +186,13 @@ public class QSBNetworkManager : NetworkManager, IAddComponentOnStart private static GameObject MakeNewNetworkObject(int assetId, string name, Type networkBehaviourType) { var bundle = QSBCore.Helper.Assets.LoadBundle("AssetBundles/qsb_empty"); + + if (bundle == null) + { + DebugLog.ToConsole($"FATAL - An assetbundle is missing! Re-install mod or contact devs.", MessageType.Fatal); + return null; + } + var template = bundle.LoadAsset("Assets/Prefabs/Empty.prefab"); bundle.Unload(false);