Repository navigation
Fix IllegalArgumentException in Search/Replace when columns have been deleted - #3206
Merged
Merged
Conversation
Column indices in the store are not contiguous after deletions, so using countColumns() as the upper bound for sequential index-based access could hit null slots and throw. Switch to table.toArray() for a gap-free snapshot and use column.getIndex() for the stored foundColumnIndex and columnsToSearch filter, which previously also compared wrong values (loop position vs store index). Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ColumnStorestores columns in a sparse array where deleted column slots becomenulland are recycled via agarbageQueue. This means column indices are not contiguous after any deletion.findOnNodesandfindOnEdgesusedtable.countColumns()as the loop upper bound and calledtable.getColumn(columnIndex)with a sequential counter. When a gap existed within0..countColumns()-1,getColumnByIndexthrewIllegalArgumentException: The column doesnt exist.columnsToSearchholds actual column store indices (fromcolumn.getIndex()), but the filter check compared them against the sequential loop counter — silently wrong after any deletion.Fix
table.toArray(), which returns a compact, gap-free snapshot of active columns.column.getIndex()for thecolumnsToSearchfilter check and forfoundColumnIndexstored inSearchResult(used by callers such ascanReplace,replace, andSearchReplaceUIto calltable.getColumn()).startingColumnstate (loop position for resuming iteration) continues to use the position within thetoArray()snapshot, which is the correct semantic.Reproducer
IllegalArgumentException: The column doesnt existMade with Cursor