Repository navigation
Conversation
A right click on a selected picture threw a NullReferenceException: SelectObjectsAction loads the context menu whose id the object's IGeoObjectShowProperty returns, ShowPropertyPicture returns null because a picture has no context menu of its own, and MenuResource.LoadMenuDefinition dereferenced the menu node it did not find. LoadMenuDefinition now returns an empty menu for a null or unknown name. The show properties of UnscaledIcon and UnscaledGeoObject threw "not implemented" from GetContextMenuId, so a right click on them failed the same way; they return null now, like the picture. The bug is older than 1.7.1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YXvDW91oXpy7RquGHNxgR5
This branch has not been deployed
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.
Problem
Right-clicking a selected picture in
CADability.Appthrew an exception, found while testing 1.8.0-preview.1:When exactly one object is selected,
SelectObjectsAction.OnMouseUploads the context menu whose id the object'sIGeoObjectShowProperty.GetContextMenuId()returns. A picture has no context menu of its own, soShowPropertyPicturereturnsnull.LoadMenuDefinitionthen found no menu node and dereferenced it.The show properties of
UnscaledIconandUnscaledGeoObjectthrew"The method or operation is not implemented."fromGetContextMenuId, so a right click on those objects failed the same way.The bug is older than 1.7.1; none of these files changed for #412.
Fix
MenuResource.LoadMenuDefinitionreturns an empty menu for anullname and for a name with no menu in the resource. The selection menu (MenuId.SelectedObjects) is still shown.ShowPropertyUnscaledIconandShowPropertyUnscaledGeoObjectreturnnullfromGetContextMenuId, like the picture.No public API changes.
Tests
ContextMenuTests:nullor unknown menu name, main menu or popup, gives an empty menu.MenuId.Picture.Path) still loads its entries.SelectObjectsActionloads is empty and nothing throws.Without the fix, 4 of the 5 tests fail. With it, all pass.
CADability.Testson Linux: 709 passed, 0 failed.Generated by Claude Code