Skip to content

Commit dfc6dd1

Browse files
committed
Fix page index type safety in PromptEditorDlg
Changed the page index variable from `int` to `size_t` to match the return type of `GetPageCount()`. This eliminates the unnecessary `>= 0` check, as `size_t` is unsigned and cannot hold negative values. The change improves type safety and prevents potential issues with signed/unsigned comparison. * Plugin/CustomControls/PromptEditorDlg.cpp **Generated by CodeLite** Signed-off-by: Eran Ifrah <eran@codelite.org>
1 parent 5eb079c commit dfc6dd1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Plugin/CustomControls/PromptEditorDlg.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ void PromptEditorDlg::SelectLabel(const wxString& label)
119119
if (item_label != label) {
120120
continue;
121121
}
122-
int page = static_cast<int>(m_dvListCtrlPrompts->GetItemData(m_dvListCtrlPrompts->RowToItem(i)));
123-
if (page >= 0 && page < m_simpleBook->GetPageCount()) {
122+
size_t page = static_cast<size_t>(m_dvListCtrlPrompts->GetItemData(m_dvListCtrlPrompts->RowToItem(i)));
123+
if (page < m_simpleBook->GetPageCount()) {
124124
m_simpleBook->SetSelection(page);
125125
m_dvListCtrlPrompts->SelectRow(i);
126126
}

0 commit comments

Comments
 (0)