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

v2 null reference in FindAndOpenChildrenMenuByHotkey when menu has separators #2892

Closed
tznind opened this issue Oct 8, 2023 · 0 comments · Fixed by #2955
Closed

v2 null reference in FindAndOpenChildrenMenuByHotkey when menu has separators #2892

tznind opened this issue Oct 8, 2023 · 0 comments · Fixed by #2955
Labels

Comments

@tznind
Copy link
Collaborator

tznind commented Oct 8, 2023

Describe the bug
When pressing an alt shortcut on a menu with a separator you get null reference exception.

This is because separators are represented as null in menu items.

To Reproduce

  1. Launch UICatalog
  2. Click on the Diagnostics menu
  3. Press Alt+D (or any other letter)
  4. Get hard crash

Screenshots

nullref

Null reference 

>	Terminal.Gui.dll!Terminal.Gui.MenuBar.FindAndOpenChildrenMenuByHotkey(Terminal.Gui.KeyEvent kb, Terminal.Gui.MenuItem[] children) Line 1847	C#
 	Terminal.Gui.dll!Terminal.Gui.MenuBar.FindAndOpenMenuByHotkey(Terminal.Gui.KeyEvent kb) Line 1828	C#
 	Terminal.Gui.dll!Terminal.Gui.MenuBar.ProcessHotKey(Terminal.Gui.KeyEvent kb) Line 1947	C#
 	Terminal.Gui.dll!Terminal.Gui.View.ProcessHotKey(Terminal.Gui.KeyEvent keyEvent) Line 361	C#
 	Terminal.Gui.dll!Terminal.Gui.Application.ProcessKeyEvent(Terminal.Gui.KeyEvent ke) Line 1264	C#
 	Terminal.Gui.dll!Terminal.Gui.WindowsDriver.ProcessInput(Terminal.Gui.WindowsConsole.InputRecord inputEvent) Line 984	C#
 	Terminal.Gui.dll!Terminal.Gui.WindowsMainLoop.Terminal.Gui.IMainLoopDriver.Iteration() Line 1932	C#
 	Terminal.Gui.dll!Terminal.Gui.MainLoop.RunIteration() Line 339	C#
 	Terminal.Gui.dll!Terminal.Gui.Application.RunMainLoopIteration(ref Terminal.Gui.RunState state, ref bool firstIteration) Line 633	C#
 	Terminal.Gui.dll!Terminal.Gui.Application.RunLoop(Terminal.Gui.RunState state) Line 615	C#
 	Terminal.Gui.dll!Terminal.Gui.Application.Run(Terminal.Gui.Toplevel view, System.Func<System.Exception, bool> errorHandler) Line 498	C#
 	Terminal.Gui.dll!Terminal.Gui.Application.Run<UICatalog.UICatalogApp.UICatalogTopLevel>(System.Func<System.Exception, bool> errorHandler, Terminal.Gui.ConsoleDriver driver, Terminal.Gui.IMainLoopDriver mainLoopDriver) Line 443	C#
 	UICatalog.dll!UICatalog.UICatalogApp.RunUICatalogTopLevel() Line 214	C#
 	UICatalog.dll!UICatalog.UICatalogApp.Main(string[] args) Line 115	C#

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

@tig tig closed this as completed Oct 17, 2023
BDisp added a commit to BDisp/Terminal.Gui that referenced this issue Nov 5, 2023
BDisp added a commit to BDisp/Terminal.Gui that referenced this issue Nov 5, 2023
@tig tig added the bug label Nov 6, 2023
tig pushed a commit that referenced this issue Nov 6, 2023
tig pushed a commit that referenced this issue Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants