Compare commits
1 commit
main
...
dev/migrie
Author | SHA1 | Date | |
---|---|---|---|
74c717acad |
|
@ -173,6 +173,15 @@ namespace winrt::TerminalApp::implementation
|
||||||
}
|
}
|
||||||
else if (const auto& realArgs = args.ActionArgs().try_as<SplitPaneArgs>())
|
else if (const auto& realArgs = args.ActionArgs().try_as<SplitPaneArgs>())
|
||||||
{
|
{
|
||||||
|
if (const auto index = newTerminalArgs.ProfileIndex())
|
||||||
|
{
|
||||||
|
if (index >= _settings->ActiveProfiles().Size())
|
||||||
|
{
|
||||||
|
args.Handled(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_SplitPane(realArgs.SplitDirection(),
|
_SplitPane(realArgs.SplitDirection(),
|
||||||
realArgs.SplitMode(),
|
realArgs.SplitMode(),
|
||||||
// This is safe, we're already filtering so the value is (0, 1)
|
// This is safe, we're already filtering so the value is (0, 1)
|
||||||
|
@ -290,6 +299,15 @@ namespace winrt::TerminalApp::implementation
|
||||||
}
|
}
|
||||||
else if (const auto& realArgs = args.ActionArgs().try_as<NewTabArgs>())
|
else if (const auto& realArgs = args.ActionArgs().try_as<NewTabArgs>())
|
||||||
{
|
{
|
||||||
|
if (const auto index = newTerminalArgs.ProfileIndex())
|
||||||
|
{
|
||||||
|
if (index >= _settings->ActiveProfiles().Size())
|
||||||
|
{
|
||||||
|
args.Handled(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
LOG_IF_FAILED(_OpenNewTab(realArgs.TerminalArgs()));
|
LOG_IF_FAILED(_OpenNewTab(realArgs.TerminalArgs()));
|
||||||
args.Handled(true);
|
args.Handled(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,6 +63,12 @@ namespace winrt::TerminalApp::implementation
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
const auto profile{ _settings.GetProfileForArgs(newTerminalArgs) };
|
const auto profile{ _settings.GetProfileForArgs(newTerminalArgs) };
|
||||||
|
// GH#11114: GetProfileForArgs can return null if the index is higher
|
||||||
|
// than the number of available profiles.
|
||||||
|
if (!profile)
|
||||||
|
{
|
||||||
|
return S_FALSE;
|
||||||
|
}
|
||||||
const auto settings{ TerminalSettings::CreateWithNewTerminalArgs(_settings, newTerminalArgs, *_bindings) };
|
const auto settings{ TerminalSettings::CreateWithNewTerminalArgs(_settings, newTerminalArgs, *_bindings) };
|
||||||
|
|
||||||
_CreateNewTabWithProfileAndSettings(profile, settings, existingConnection);
|
_CreateNewTabWithProfileAndSettings(profile, settings, existingConnection);
|
||||||
|
|
|
@ -1560,6 +1560,12 @@ namespace winrt::TerminalApp::implementation
|
||||||
if (!profile)
|
if (!profile)
|
||||||
{
|
{
|
||||||
profile = _settings.GetProfileForArgs(newTerminalArgs);
|
profile = _settings.GetProfileForArgs(newTerminalArgs);
|
||||||
|
// GH#11114: GetProfileForArgs can return null if the index is
|
||||||
|
// higher than the number of available profiles.
|
||||||
|
if (!profile)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
controlSettings = TerminalSettings::CreateWithNewTerminalArgs(_settings, newTerminalArgs, *_bindings);
|
controlSettings = TerminalSettings::CreateWithNewTerminalArgs(_settings, newTerminalArgs, *_bindings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -537,6 +537,13 @@ Model::Profile CascadiaSettings::GetProfileForArgs(const Model::NewTerminalArgs&
|
||||||
{
|
{
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// GH#11114 - Return NOTHING if they asked for a profile index
|
||||||
|
// outside the range of available profiles.
|
||||||
|
// Really, the caller should check this beforehand
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue