Skip to content

Guard getFixedNum against a None simpleFirstChild - #50

Open
serrebidev wants to merge 1 commit into
ABuffEr:masterfrom
serrebidev:guard-none-simplefirstchild
Open

Guard getFixedNum against a None simpleFirstChild#50
serrebidev wants to merge 1 commit into
ABuffEr:masterfrom
serrebidev:guard-none-simplefirstchild

Conversation

@serrebidev

Copy link
Copy Markdown
Contributor

Problem

script_readColumn (NVDA+Ctrl+<n>) crashes on some list controls with:

File ".../columnsReview/__init__.py", line 793, in getFixedNum
    startNum = child.columnNumber-1
AttributeError: 'NoneType' object has no attribute 'columnNumber'

getFixedNum reads curItem.simpleFirstChild.columnNumber to work out the invisible-column offset, but simpleFirstChild can be None even when childCount > 0.

Reproduction

Reproducible on a wxWidgets wxListCtrl (report view) on recent wxWidgets 3.2.x builds (via wxPython): NVDA reports the focused list item has columns (childCount > 0) but exposes no simple first child, so every row of the list fails with the error above. (Originally reported against a wxPython app, NVDA 2026.2beta.)

Fix

When there is no usable first child, fall back to treating the pressed number as the 1-based column index instead of raising. The add-on then degrades gracefully to a normal column read (or the existing "no more visible columns" path) rather than an error dialog. No behavior change for lists that already expose a first child.

script_readColumn crashes with "'NoneType' object has no attribute
'columnNumber'" on some list controls that report childCount > 0 but expose no
simple first child object. This is reproducible with wxWidgets wxListCtrl on
recent wxWidgets builds (3.2.x): NVDA+Ctrl+<n> fails on every row of the list.

getFixedNum reads simpleFirstChild.columnNumber to compute the invisible-column
offset. When there is no first child, fall back to treating the pressed number
as the 1-based column index instead of raising, so the add-on degrades to a
normal column read (or "no more visible columns") rather than an error dialog.
@serrebidev

Copy link
Copy Markdown
Contributor Author

The failing build addon check on this PR is not caused by these changes — it's pre-existing and fails identically on master.

I checked out master at 42d55a9 (no changes from this PR) and ran the CI step locally: SKIP=no-commit-to-branch pre-commit run --all-files fails there with the same 16 ruff errors and 34 pyright errors. The last five build addon runs have all failed for the same reason. None of the reported files (compat.py, installTasks.py, and the bare-except: sites) are touched by this PR — the only change here is the getFixedNum guard.

I've opened #51, which fixes the check itself; it builds green. If you'd like, I'm happy to rebase this PR on top of that once you've decided what to do with it.

The bug this fixes is unrelated to any of that: simpleFirstChild can be None while childCount > 0, so script_readColumn raises AttributeError on every row of an affected wxListCtrl.

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.

1 participant