[PR #9495] [MERGED] Invalidate nested command with no valid subcommands #27601

Open
opened 2026-01-31 09:22:56 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/9495
Author: @Don-Vito
Created: 3/14/2021
Status: Merged
Merged: 3/15/2021
Merged by: @undefined

Base: mainHead: 9448-empty-nested-command


📝 Commits (2)

  • 63c00bc Invalidate nested command with no valid subcommands
  • bfa47f9 Add UT asserting no invalid command is created

📊 Changes

7 files changed (+82 additions, -8 deletions)

View changed files

📝 src/cascadia/LocalTests_SettingsModel/DeserializationTests.cpp (+57 -6)
📝 src/cascadia/TerminalApp/AppLogic.cpp (+2 -1)
📝 src/cascadia/TerminalApp/Resources/en-US/Resources.resw (+4 -1)
📝 src/cascadia/TerminalApp/ShortcutActionDispatch.cpp (+5 -0)
📝 src/cascadia/TerminalSettingsModel/Command.cpp (+6 -0)
📝 src/cascadia/TerminalSettingsModel/GlobalAppSettings.cpp (+7 -0)
📝 src/cascadia/TerminalSettingsModel/TerminalWarnings.idl (+1 -0)

📄 Description

Currently, when loading command with sub-commands that fail to parse,
we result with command that:

  • Is not considered nested (has no sub-commands)
  • Has no action of its own

The commit contains a few changes:

  1. Protection in the dispatch that will prevent NPE
  2. Change in the command parsing that will no load
    a command if all its sub-commands failed to parse
  3. We will add a warning in this case (the solution is somewhat
    hacky, due to the hack that was there previously)

When such command is passed to a dispatch we crash with NPE.

Closes #9448


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/9495 **Author:** [@Don-Vito](https://github.com/Don-Vito) **Created:** 3/14/2021 **Status:** ✅ Merged **Merged:** 3/15/2021 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `9448-empty-nested-command` --- ### 📝 Commits (2) - [`63c00bc`](https://github.com/microsoft/terminal/commit/63c00bc10832d7688d6748555f781990c26bb684) Invalidate nested command with no valid subcommands - [`bfa47f9`](https://github.com/microsoft/terminal/commit/bfa47f922b6a388405bfa039ad6ef4d1cf382e6a) Add UT asserting no invalid command is created ### 📊 Changes **7 files changed** (+82 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/LocalTests_SettingsModel/DeserializationTests.cpp` (+57 -6) 📝 `src/cascadia/TerminalApp/AppLogic.cpp` (+2 -1) 📝 `src/cascadia/TerminalApp/Resources/en-US/Resources.resw` (+4 -1) 📝 `src/cascadia/TerminalApp/ShortcutActionDispatch.cpp` (+5 -0) 📝 `src/cascadia/TerminalSettingsModel/Command.cpp` (+6 -0) 📝 `src/cascadia/TerminalSettingsModel/GlobalAppSettings.cpp` (+7 -0) 📝 `src/cascadia/TerminalSettingsModel/TerminalWarnings.idl` (+1 -0) </details> ### 📄 Description Currently, when loading command with sub-commands that fail to parse, we result with command that: * Is not considered nested (has no sub-commands) * Has no action of its own The commit contains a few changes: 1. Protection in the dispatch that will prevent NPE 2. Change in the command parsing that will no load a command if all its sub-commands failed to parse 3. We will add a warning in this case (the solution is somewhat hacky, due to the hack that was there previously) When such command is passed to a dispatch we crash with NPE. Closes #9448 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:22:56 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#27601