From faf1164449184f22886c6b94fdb4ee67346960c5 Mon Sep 17 00:00:00 2001 From: sneakzttv <57473220+sneakzttv@users.noreply.github.com> Date: Thu, 9 Jan 2025 16:33:54 +0800 Subject: [PATCH] Webhook project setttings fix (#1265) Ternary operator fix altered the ternary operator to account for cases where websocket is empty. --- .../Editor/Web3SettingsEditor.ChainSettings.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Packages/io.chainsafe.web3-unity/Editor/Web3SettingsEditor.ChainSettings.cs b/Packages/io.chainsafe.web3-unity/Editor/Web3SettingsEditor.ChainSettings.cs index 8e4189ad1..253b73668 100644 --- a/Packages/io.chainsafe.web3-unity/Editor/Web3SettingsEditor.ChainSettings.cs +++ b/Packages/io.chainsafe.web3-unity/Editor/Web3SettingsEditor.ChainSettings.cs @@ -141,8 +141,9 @@ public void OnGUI() selectedWebHookIndex = Mathf.Clamp(selectedWebHookIndex, 0, window.chainList[selectedChainIndex].rpc.Count - 1); var webhookIndex = window.chainList[selectedChainIndex].rpc.IndexOf(chainConfig.Ws); - var selectedWebHook = - webhookIndex == -1 ? window.chainList[selectedChainIndex].rpc[selectedWebHookIndex] : chainConfig.Ws; + var selectedWebHook = (webhookIndex == -1 || string.IsNullOrEmpty(chainConfig.Ws)) + ? window.chainList[selectedChainIndex].rpc[selectedWebHookIndex] + : chainConfig.Ws; if (GUILayout.Button(selectedWebHook, EditorStyles.popup)) { searchProvider = CreateInstance();