Skip to content

Catch exception when word contains invalid data#6325

Merged
feerrenrut merged 2 commits into
masterfrom
i5886-ElementsListNotAppearing
Sep 19, 2016
Merged

Catch exception when word contains invalid data#6325
feerrenrut merged 2 commits into
masterfrom
i5886-ElementsListNotAppearing

Conversation

@feerrenrut

Copy link
Copy Markdown
Contributor

An example document contained some kind of hidden hyperlink, which looks
like it is an invalid element. When trying to get range information an
exception is thrown with the COM error "Object has been deleted". The
fix is to catch the exception, record information in the log, and
discard the item, continuing with iteration over the rest of the items.

Fixes #5886

An example document contained some kind of hidden hyperlink, which looks
 like it is an invalid element. When trying to get range information an
 exception is thrown with the COM error "Object has been deleted". The
 fix is to catch the exception, record information in the log, and
 discard the item, continuing with iteration over the rest of the items.
@feerrenrut

Copy link
Copy Markdown
Contributor Author

@michaelDCurran Could you please take a look at this when you get the chance?

Comment thread source/NVDAObjects/window/winword.py Outdated
try:
item=self.quickNavItemClass(self.itemType,self.document,collectionItem)
itemRange=item.rangeObj
except:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume it raises COMError? If so perhaps best to just catch that specifically, so as to not hide other more critical errors.

@michaelDCurran

Copy link
Copy Markdown
Member

Fine with it, barring the except statement.

Comment thread source/NVDAObjects/window/winword.py Outdated
itemRange=item.rangeObj
try:
item=self.quickNavItemClass(self.itemType,self.document,collectionItem)
itemRange=item.rangeObj

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move this outside the try/except.

@jcsteh

jcsteh commented Sep 5, 2016

Copy link
Copy Markdown
Contributor

All good!

feerrenrut added a commit that referenced this pull request Sep 5, 2016
Re #5886
Merge branch 'i5886-ElementsListNotAppearing' into next
@feerrenrut feerrenrut merged commit 0bf9223 into master Sep 19, 2016
@nvaccessAuto nvaccessAuto added this to the 2016.4 milestone Sep 19, 2016
feerrenrut added a commit that referenced this pull request Sep 19, 2016
Fixed an issue that stops the the elements list from appearing when Microsoft Word contains an invalid hyperlink. (#5886)
@feerrenrut feerrenrut deleted the i5886-ElementsListNotAppearing branch January 17, 2020 09:01
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.

Elements List not appearing or functioning with MS-Word 2010

4 participants