Skip to content

fix clicking LISTBOX_LOG#3138

Merged
mercury233 merged 1 commit into
masterfrom
mercury233-patch-2
Jul 11, 2026
Merged

fix clicking LISTBOX_LOG#3138
mercury233 merged 1 commit into
masterfrom
mercury233-patch-2

Conversation

@mercury233

Copy link
Copy Markdown
Collaborator
  • size() == sel mean out of bounds
  • improve readability

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts the LISTBOX_LOG click handling in ClientField::OnCommonEvent to prevent out-of-bounds access when the selected index equals the log parameter vector size, and aims to make the guard condition clearer.

Changes:

  • Fix off-by-one bounds check for logParam indexing (size() == sel should be treated as out-of-bounds).
  • Tighten/clarify selection validity checks before opening card info / switching info tabs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread gframe/event_handler.cpp
case LISTBOX_LOG: {
int sel = mainGame->lstLog->getSelected();
if(sel != -1 && (int)mainGame->logParam.size() >= sel && mainGame->logParam[sel]) {
if(sel >= 0 && (int)mainGame->logParam.size() > sel && mainGame->logParam[sel] > 0) {
Comment thread gframe/event_handler.cpp
case LISTBOX_LOG: {
int sel = mainGame->lstLog->getSelected();
if(sel != -1 && (int)mainGame->logParam.size() >= sel && mainGame->logParam[sel]) {
if(sel >= 0 && (int)mainGame->logParam.size() > sel && mainGame->logParam[sel] > 0) {
@mercury233 mercury233 merged commit e0d69a3 into master Jul 11, 2026
17 checks passed
@mercury233 mercury233 deleted the mercury233-patch-2 branch July 11, 2026 01:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants