diff --git a/Dalamud/Interface/ItemSearchWindow.cs b/Dalamud/Interface/ItemSearchWindow.cs index ba7512088..88b89fdf0 100644 --- a/Dalamud/Interface/ItemSearchWindow.cs +++ b/Dalamud/Interface/ItemSearchWindow.cs @@ -186,15 +186,23 @@ namespace Dalamud.Interface ImGui.EndChild(); - if (ImGui.Button(Loc.Localize("Choose", "Choose"))) { - OnItemChosen?.Invoke(this, this.searchTask.Result[this.selectedItemIndex]); + // Darken choose button if it shouldn't be clickable + ImGui.PushStyleVar(ImGuiStyleVar.Alpha, this.selectedItemIndex < 0 ? 0.25f : 1); - if (this.closeOnChoose) { - this.selectedItemTex?.Dispose(); - isOpen = false; + if (ImGui.Button(Loc.Localize("Choose", "Choose"))) { + try { + OnItemChosen?.Invoke(this, this.searchTask.Result[this.selectedItemIndex]); + if (this.closeOnChoose) { + this.selectedItemTex?.Dispose(); + isOpen = false; + } + } catch (Exception ex) { + Log.Error($"Exception in Choose: {ex.Message}"); } } + ImGui.PopStyleVar(); + if (!this.closeOnChoose) { ImGui.SameLine(); if (ImGui.Button(Loc.Localize("Close", "Close")))