Skip to content

Commit 30d7470

Browse files
Sebastian Muehrclaude
andcommitted
fix: address CodeRabbit nitpicks
- Adapt param type in Download fallback loop (string conversion) - Log exceptions in DestroyHiddenWindow and CreateInstance instead of silently swallowing them Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 0b109cd commit 30d7470

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

MCPForUnity/Editor/Tools/ManageAssetStore.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ private static void DestroyHiddenWindow()
259259
if (_hiddenWindowInstance != null)
260260
{
261261
try { UnityEngine.Object.DestroyImmediate(_hiddenWindowInstance); }
262-
catch { }
262+
catch (Exception e) { McpLog.Warn($"[ManageAssetStore] DestroyHiddenWindow: {e.Message}"); }
263263
_hiddenWindowInstance = null;
264264
_cachedRoot = null;
265265
_serviceCache.Clear();
@@ -778,7 +778,9 @@ private static object StartDownload(long productId)
778778
{
779779
if (ps.Length == 1)
780780
{
781-
dm.Invoke(managerInstance, new object[] { productId });
781+
object arg = ps[0].ParameterType == typeof(string)
782+
? (object)productId.ToString() : productId;
783+
dm.Invoke(managerInstance, new object[] { arg });
782784
invoked = true;
783785
invokedOverload = ps[0].ParameterType.Name;
784786
break;
@@ -964,7 +966,10 @@ private static object GetPackageManagerRoot()
964966
_hiddenWindowInstance = ScriptableObject.CreateInstance(windowType);
965967
windows = new[] { _hiddenWindowInstance };
966968
}
967-
catch { }
969+
catch (Exception e)
970+
{
971+
McpLog.Warn($"[ManageAssetStore] Failed to create hidden PM window: {e.Message}");
972+
}
968973

969974
if (windows == null || windows.Length == 0)
970975
return null;

0 commit comments

Comments
 (0)