From 3f206d46af986e90a6cdd69c17ed2cf73aeb2741 Mon Sep 17 00:00:00 2001 From: Leon Richardt Date: Mon, 15 Mar 2021 17:45:56 +0100 Subject: [PATCH] fix: no longer crash on clip creation in "special" channels (#2528) --- CHANGELOG.md | 2 +- src/controllers/commands/CommandController.cpp | 4 +++- src/widgets/splits/Split.cpp | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 726a33fd..e3853437 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## Unversioned -- Major: Added clip creation support. You can create clips with `/clip` command, `Alt+X` keybind or `Create a clip` option in split header's context menu. This requires a new authentication scope so re-authentication will be required to use it. (#2271, #2377) +- Major: Added clip creation support. You can create clips with `/clip` command, `Alt+X` keybind or `Create a clip` option in split header's context menu. This requires a new authentication scope so re-authentication will be required to use it. (#2271, #2377, #2528) - Major: Added "Channel Filters". See https://wiki.chatterino.com/Filters/ for how they work or how to configure them. (#1748, #2083, #2090, #2200, #2225) - Major: Added Streamer Mode configuration (under `Settings -> General`), where you can select which features of Chatterino should behave differently when you are in Streamer Mode. (#2001, #2316, #2342, #2376) - Major: Color mentions to match the mentioned users. You can disable this by unchecking "Color @usernames" under `Settings -> General -> Advanced (misc.)`. (#1963, #2284) diff --git a/src/controllers/commands/CommandController.cpp b/src/controllers/commands/CommandController.cpp index 6b27f5da..2d07dff1 100644 --- a/src/controllers/commands/CommandController.cpp +++ b/src/controllers/commands/CommandController.cpp @@ -523,7 +523,9 @@ void CommandController::initialize(Settings &, Paths &paths) }); this->registerCommand("/clip", [](const auto & /*words*/, auto channel) { - if (!channel->isTwitchChannel()) + if (const auto type = channel->getType(); + type != Channel::Type::Twitch && + type != Channel::Type::TwitchWatching) { return ""; } diff --git a/src/widgets/splits/Split.cpp b/src/widgets/splits/Split.cpp index 5e463901..77ed3cdd 100644 --- a/src/widgets/splits/Split.cpp +++ b/src/widgets/splits/Split.cpp @@ -123,7 +123,9 @@ Split::Split(QWidget *parent) // Alt+X: create clip LUL createShortcut(this, "Alt+X", [this] { - if (!this->getChannel()->isTwitchChannel()) + if (const auto type = this->getChannel()->getType(); + type != Channel::Type::Twitch && + type != Channel::Type::TwitchWatching) { return; }