From 35f32478c1d58ad72cfa279cada7e1684dd49761 Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Thu, 28 Dec 2023 12:40:13 -0500 Subject: [PATCH] com.utilities.rest 2.4.2 (#58) - fixed null reference exception when creating configuration --- .../Editor/BaseConfigurationInspector.cs | 8 ++++++-- Utilities.Rest/Packages/com.utilities.rest/package.json | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Utilities.Rest/Packages/com.utilities.rest/Editor/BaseConfigurationInspector.cs b/Utilities.Rest/Packages/com.utilities.rest/Editor/BaseConfigurationInspector.cs index 5b25dbe..878e6b4 100644 --- a/Utilities.Rest/Packages/com.utilities.rest/Editor/BaseConfigurationInspector.cs +++ b/Utilities.Rest/Packages/com.utilities.rest/Editor/BaseConfigurationInspector.cs @@ -74,8 +74,12 @@ protected static TConfiguration GetOrCreateInstance(Object target = null) { AssetDatabase.DeleteAsset(currentPath); var instances = AssetDatabase.FindAssets($"t:{typeof(TConfiguration).Name}"); - var path = AssetDatabase.GUIDToAssetPath(instances[0]); - instance = AssetDatabase.LoadAssetAtPath(path); + + if (instances is { Length: > 0 }) + { + var path = AssetDatabase.GUIDToAssetPath(instances[0]); + instance = AssetDatabase.LoadAssetAtPath(path); + } } update = true; diff --git a/Utilities.Rest/Packages/com.utilities.rest/package.json b/Utilities.Rest/Packages/com.utilities.rest/package.json index 8765f0d..dddc7a8 100644 --- a/Utilities.Rest/Packages/com.utilities.rest/package.json +++ b/Utilities.Rest/Packages/com.utilities.rest/package.json @@ -3,7 +3,7 @@ "displayName": "Utilities.Rest", "description": "This package contains useful RESTful utilities for the Unity Game Engine.", "keywords": [], - "version": "2.4.1", + "version": "2.4.2", "unity": "2021.3", "documentationUrl": "https://github.com/RageAgainstThePixel/com.utilities.rest#documentation", "changelogUrl": "https://github.com/RageAgainstThePixel/com.utilities.rest/releases",