Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assumption of an app module is causing AttributeError #21

Closed
cartertemm opened this issue May 24, 2024 · 0 comments
Closed

Assumption of an app module is causing AttributeError #21

cartertemm opened this issue May 24, 2024 · 0 comments

Comments

@cartertemm
Copy link
Contributor

In some programs, like Notepad2 or any other application where there is no product name for the active app module, the addon is erroring out when trying to determine whether VSCode is focused. Traceback is as follows:

error executing script: <bound method EditableIndentNav.script_moveToPreviousSibling of <NVDAObjects.Dynamic_ScintillaIAccessibleScintillaWindowNVDAObjectEditableIndentNav object at 0x2422A2F0>> with gesture 'alt+NVDA+up arrow'
Traceback (most recent call last):
  File "scriptHandler.pyc", line 295, in executeScript
  File "C:\users\username\AppData\Roaming\nvda\addons\IndentNav\globalPlugins\indent_nav\__init__.py", line 1672, in script_moveToPreviousSibling
    self.move(-1, [msgEditable])
  File "C:\users\username\AppData\Roaming\nvda\addons\IndentNav\globalPlugins\indent_nav\__init__.py", line 1717, in move
    self.moveInEditable(increment, errorMessages[0], unbounded, op, speakOnly=speakOnly, moveCount=moveCount, excludeFilterRegex=excludeFilterRegex)
  File "C:\users\username\AppData\Roaming\nvda\addons\IndentNav\globalPlugins\indent_nav\__init__.py", line 1721, in moveInEditable
    with self.getLineManager() as lm:
  File "C:\users\username\AppData\Roaming\nvda\addons\IndentNav\globalPlugins\indent_nav\__init__.py", line 993, in __enter__
    document = self.obj.makeEnhancedTextInfo(textInfos.POSITION_ALL, allowPlainTextInfoInVSCode=legacyVSCode)
  File "C:\users\username\AppData\Roaming\nvda\addons\IndentNav\globalPlugins\indent_nav\__init__.py", line 1999, in makeEnhancedTextInfo
    if not self.isVscodeApp():
  File "C:\users\username\AppData\Roaming\nvda\addons\IndentNav\globalPlugins\indent_nav\__init__.py", line 1975, in isVscodeApp
    return self.appModule.productName.startswith("Visual Studio Code")
AttributeError: 'NoneType' object has no attribute 'startswith'

This should be an easy fix, just check to see whether the productName is of type None. If so, convert it to a string.

@mltony mltony closed this as completed in a993b12 May 24, 2024
mltony added a commit that referenced this issue May 24, 2024
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

No branches or pull requests

1 participant