[PR #11428] [MERGED] Fix null pointer exceptions for default constructed CascadiaSettings instances #28568

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/11428
Author: @lhecker
Created: 10/6/2021
Status: Merged
Merged: 10/6/2021
Merged by: @undefined

Base: mainHead: dev/lhecker/settings-crash-fix


📝 Commits (1)

  • c9a7dec Fix null pointer exception

📊 Changes

2 files changed (+13 additions, -6 deletions)

View changed files

📝 src/cascadia/TerminalSettingsModel/CascadiaSettings.h (+5 -5)
📝 src/cascadia/TerminalSettingsModel/CascadiaSettingsSerialization.cpp (+8 -1)

📄 Description

CascadiaSettings is default constructed when human readable error messages are
returned. Even in such cases we need to ensure that all fields are properly
initialized, as a caller might decide to call a GlobalSettings getter.
Thus a crash occurred whenever a user was hot-reloading their settings file with
invalid JSON as other code then tried to compare the GlobalSettings().

PR Checklist

  • I work here
  • Tests added/passed

Validation Steps Performed

  • Start Windows Terminal and ensure the settings load fine
  • Add "commandline": 123 to any of the generated profiles in settings.json
  • The application doesn't crash and shows a warning message

🔄 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/11428 **Author:** [@lhecker](https://github.com/lhecker) **Created:** 10/6/2021 **Status:** ✅ Merged **Merged:** 10/6/2021 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `dev/lhecker/settings-crash-fix` --- ### 📝 Commits (1) - [`c9a7dec`](https://github.com/microsoft/terminal/commit/c9a7deca11bccf66798726725d219bd94e6a5520) Fix null pointer exception ### 📊 Changes **2 files changed** (+13 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalSettingsModel/CascadiaSettings.h` (+5 -5) 📝 `src/cascadia/TerminalSettingsModel/CascadiaSettingsSerialization.cpp` (+8 -1) </details> ### 📄 Description `CascadiaSettings` is default constructed when human readable error messages are returned. Even in such cases we need to ensure that all fields are properly initialized, as a caller might decide to call a `GlobalSettings` getter. Thus a crash occurred whenever a user was hot-reloading their settings file with invalid JSON as other code then tried to compare the `GlobalSettings()`. ## PR Checklist * [x] I work here * [x] Tests added/passed ## Validation Steps Performed * Start Windows Terminal and ensure the settings load fine * Add `"commandline": 123` to any of the generated profiles in settings.json * The application doesn't crash and shows a warning message --- <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:29:20 +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#28568