Repository: nvaccess/nvda

Issue:
Error in alpha with built-in audacity appmod
### Steps to reproduce:

1. open audacity.
2. select audio. ctrl+a works.
3. press alt+c, and press c until "compresser" is found.
4. press enter.
5. press tab.

### Actual behavior:

```
ERROR - eventHandler.executeEvent (23:07:33.553):
error executing event: gainFocus on <NVDAObjects.IAccessible.IAccessible object at 0x03318FF0> with extra args of {}
Traceback (most recent call last):
  File "eventHandler.pyc", line 150, in executeEvent
  File "eventHandler.pyc", line 163, in doPreGainFocus
  File "api.pyc", line 109, in setFocusObject
  File "baseObject.pyc", line 46, in __get__
  File "baseObject.pyc", line 149, in _getPropertyViaCache
  File "NVDAObjects\IAccessible\__init__.pyc", line 1695, in _get_container
  File "IAccessibleHandler.pyc", line 950, in findGroupboxObject
  File "NVDAObjects\IAccessible\__init__.pyc", line 48, in getNVDAObjectFromEvent
  File "NVDAObjects\__init__.pyc", line 137, in __call__
  File "appModules\audacity.pyc", line 15, in event_NVDAObject_init
AttributeError: 'NoneType' object has no attribute 'replace'
```

### Expected behavior:

Items in the UI read.

### System configuration
#### NVDA installed/portable/running from source:
installed

#### NVDA version:
Version: alpha-18399,26485a09


#### Windows version:
^10

#### Name and version of other software in use when reproducing the issue:
Audacity: 2.3.1




Discussion:
Hi, ah, another object model issue we need to handle. I bet there are more things of this nature we haven’t gotten to fixing once and for all. CC @LeonardDer, a P2. Thanks.

 

From: Derek Riemer <notifications@github.com> 
Sent: Thursday, August 15, 2019 10:11 PM
To: nvaccess/nvda <nvda@noreply.github.com>
Cc: Subscribed <subscribed@noreply.github.com>
Subject: [nvaccess/nvda] Error in alpha with built-in audacity appmod (#10103)

 


Steps to reproduce:


1.	open audacity.
2.	select audio. ctrl+a works.
3.	press alt+c, and press c until "compresser" is found.
4.	press enter.
5.	press tab.


Actual behavior:

ERROR - eventHandler.executeEvent (23:07:33.553):
error executing event: gainFocus on <NVDAObjects.IAccessible.IAccessible object at 0x03318FF0> with extra args of {}
Traceback (most recent call last):
  File "eventHandler.pyc", line 150, in executeEvent
  File "eventHandler.pyc", line 163, in doPreGainFocus
  File "api.pyc", line 109, in setFocusObject
  File "baseObject.pyc", line 46, in __get__
  File "baseObject.pyc", line 149, in _getPropertyViaCache
  File "NVDAObjects\IAccessible\__init__.pyc", line 1695, in _get_container
  File "IAccessibleHandler.pyc", line 950, in findGroupboxObject
  File "NVDAObjects\IAccessible\__init__.pyc", line 48, in getNVDAObjectFromEvent
  File "NVDAObjects\__init__.pyc", line 137, in __call__
  File "appModules\audacity.pyc", line 15, in event_NVDAObject_init
AttributeError: 'NoneType' object has no attribute 'replace'

Expected behavior:


Items in the UI read.


System configuration


NVDA installed/portable/running from source:


installed


NVDA version:


Version: alpha-18399,26485a09


Windows version:


^10


Name and version of other software in use when reproducing the issue:


Audacity: 2.3.1

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <https://github.com/nvaccess/nvda/issues/10103?email_source=notifications&email_token=AB4AXED7ODFTTL3SOXKE6B3QEYZGJA5CNFSM4IMECP6KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HFSIHMQ> , or mute the thread <https://github.com/notifications/unsubscribe-auth/AB4AXEC2KDELD6EBNCU3HJ3QEYZGJANCNFSM4IMECP6A> .



Resolving patch:
diff --git a/source/appModules/audacity.py b/source/appModules/audacity.py
--- a/source/appModules/audacity.py
+++ b/source/appModules/audacity.py
@@ -1,9 +1,8 @@
 # -*- coding: UTF-8 -*-
-#appModules/audacity.py
-#A part of NonVisual Desktop Access (NVDA)
-#Copyright (C) 2006-2018 NV Access Limited, Robert Hänggi
-#This file is covered by the GNU General Public License.
-#See the file COPYING for more details.
+# A part of NonVisual Desktop Access (NVDA)
+# Copyright (C) 2006-2019 NV Access Limited, Robert Hänggi, Łukasz Golonka
+# This file is covered by the GNU General Public License.
+# See the file COPYING for more details.
 
 import appModuleHandler
 import controlTypes
@@ -11,5 +10,9 @@
 class AppModule(appModuleHandler.AppModule):
 
 	def event_NVDAObject_init(self,obj):
-		if obj.windowClassName=="Button" and not obj.role in [controlTypes.ROLE_MENUBAR, controlTypes.ROLE_MENUITEM, controlTypes.ROLE_POPUPMENU]:
+		if (
+			obj.windowClassName == "Button"
+			and obj.role not in [controlTypes.ROLE_MENUBAR, controlTypes.ROLE_MENUITEM, controlTypes.ROLE_POPUPMENU]
+			and obj.name is not None
+		):
 			obj.name=obj.name.replace('&','')


Test patch: