Attempt to catch std::bad_function_call when adding a channel point reward (#4360)
* fix: attempt to catch std::bad_function_call * chore: add changelog entry * fix: spelling mistake Co-authored-by: Leon Richardt <git@leon.dev> --------- Co-authored-by: Leon Richardt <git@leon.dev>
This commit is contained in:
@@ -304,7 +304,21 @@ void TwitchChannel::addChannelPointReward(const ChannelPointReward &reward)
|
||||
<< "[TwitchChannel" << this->getName()
|
||||
<< "] Channel point reward added:" << reward.id << ","
|
||||
<< reward.title << "," << reward.isUserInputRequired;
|
||||
this->channelPointRewardAdded.invoke(reward);
|
||||
|
||||
// TODO: There's an underlying bug here. This bug should be fixed.
|
||||
// This only attempts to prevent a crash when invoking the signal.
|
||||
try
|
||||
{
|
||||
this->channelPointRewardAdded.invoke(reward);
|
||||
}
|
||||
catch (const std::bad_function_call &)
|
||||
{
|
||||
qCWarning(chatterinoTwitch).nospace()
|
||||
<< "[TwitchChannel " << this->getName()
|
||||
<< "] Caught std::bad_function_call when adding channel point "
|
||||
"reward ChannelPointReward{ id: "
|
||||
<< reward.id << ", title: " << reward.title << " }.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user