Skip to content

Commit 7345dfc

Browse files
committed
BundleLoad NRE checks
- Added checks for if the directory exists, and if the RustDirectory points to a folder called Rust.
1 parent e61ec40 commit 7345dfc

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

Assets/MapEditor/Managers/AssetManager.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,18 @@ public static void Initialise(string bundlesRoot)
2626
{
2727
if (!IsInitialised)
2828
{
29+
if (!Directory.Exists(SettingsManager.RustDirectory))
30+
{
31+
Debug.LogError("Directory does not exist: " + bundlesRoot);
32+
return;
33+
}
34+
35+
if (!SettingsManager.RustDirectory.EndsWith("Rust"))
36+
{
37+
Debug.LogError("Not a valid Rust install directory: " + SettingsManager.RustDirectory);
38+
return;
39+
}
40+
2941
ProgressBarManager.Display("Loading Bundles", "Loading Root Bundle", 0.1f);
3042
BundlePath = bundlesRoot;
3143
var rootBundle = AssetBundle.LoadFromFile(bundlesRoot);
@@ -36,7 +48,6 @@ public static void Initialise(string bundlesRoot)
3648
}
3749

3850
var manifestList = rootBundle.LoadAllAssets<AssetBundleManifest>();
39-
4051
if (manifestList.Length != 1)
4152
{
4253
Debug.LogError("Couldn't find AssetBundleManifest - " + manifestList.Length);

0 commit comments

Comments
 (0)