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

fix: no longer crash on clip creation in "special" channels #2528

Merged
merged 2 commits into from Mar 15, 2021

Conversation

leon-richardt
Copy link
Collaborator

@leon-richardt leon-richardt commented Mar 15, 2021

Pull request checklist:

  • CHANGELOG.md was updated, if applicable

Description

Fixes #2527.

Clip creation via the Alt+X shortcut failed for the /mentions and /whispers channel. This happened because Channel::isTwitchChannel returns true for these channels. (Internally, the types are Channel::Type::TwitchMentions and Channel::Type::TwitchWhispers in anticipation of supporting more platforms in the future.)
This lead to a false assumption in the clip creation logic: Not all channels that display "Twitch content" are able to create clips.

The employed fix checks the channel type in more detail. Clip creation is only allowed if the channel is Channel::Type::Twitch or Channel::Type::TwitchWatching. This makes sure that there always is an associated channel to generate a clip from.

Additional note: Clip creation did not crash when initiated via the /clip command. This is due to the fact that CommandController::execCommand makes additional checks regarding the channel context before executing the command.

Clip creation via the `Alt+X` shortcut failed for the `/mentions` and
`/whispers` channel. This happened because `Channel::isTwitchChannel`
returns `true` for these channels. (Internally, the types are
`Channel::Type::TwitchMentions` and `Channel::Type::TwitchWhispers` in
anticipation of supporting more platforms in the future.)
This lead to a false assumption in the clip creation logic: Not all
channels that display "Twitch content" are able to create clips.

The employed fix checks the channel type in more detail. Clip creation
is only allowed if the channel is `Channel::Type::Twitch` or
`Channel::Type::TwitchWatching`. This makes sure that there always is an
associated channel to generate a clip from.

Additional note: Clip creation did not crash when initiated via the
`/clip` command. This is due to the fact that
`CommandController::execCommand` makes additional checks regarding the
channel context before executing the command.
Copy link
Collaborator

@zneix zneix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I had no idea these channels still return true for isTwitchChannel() 👍

@pajlada pajlada merged commit 3f206d4 into Chatterino:master Mar 15, 2021
13 checks passed
@leon-richardt leon-richardt mentioned this pull request Mar 23, 2021
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clip in '/mentions' crashes app
3 participants