@@ -265,7 +265,7 @@ void AutoConfigStreamPage::on_show_clicked()
265265
266266void AutoConfigStreamPage::OnOAuthStreamKeyConnected ()
267267{
268- OAuthStreamKey *a = reinterpret_cast <OAuthStreamKey *>(auth.get ());
268+ OAuthStreamKey *a = dynamic_cast <OAuthStreamKey *>(auth.get ());
269269
270270 if (a) {
271271 bool validKey = !a->key ().empty ();
@@ -292,16 +292,17 @@ void AutoConfigStreamPage::OnOAuthStreamKeyConnected()
292292
293293 ui->connectedAccountText ->setText (QTStr (" Auth.LoadingChannel.Title" ));
294294
295- YoutubeApiWrappers *ytAuth = reinterpret_cast <YoutubeApiWrappers *>(a);
296- ChannelDescription cd;
297- if (ytAuth->GetChannelDescription (cd)) {
298- ui->connectedAccountText ->setText (cd.title );
299-
300- /* Create throwaway stream key for bandwidth test */
301- if (ui->doBandwidthTest ->isChecked ()) {
302- StreamDescription stream = {" " , " " , " OBS Studio Test Stream" };
303- if (ytAuth->InsertStream (stream)) {
304- ui->key ->setText (stream.name );
295+ if (YoutubeApiWrappers *ytAuth = dynamic_cast <YoutubeApiWrappers *>(a)) {
296+ ChannelDescription cd;
297+ if (ytAuth->GetChannelDescription (cd)) {
298+ ui->connectedAccountText ->setText (cd.title );
299+
300+ /* Create throwaway stream key for bandwidth test */
301+ if (ui->doBandwidthTest ->isChecked ()) {
302+ StreamDescription stream = {" " , " " , " OBS Studio Test Stream" };
303+ if (ytAuth->InsertStream (stream)) {
304+ ui->key ->setText (stream.name );
305+ }
305306 }
306307 }
307308 }
@@ -406,7 +407,7 @@ void AutoConfigStreamPage::reset_service_ui_fields(std::string &service)
406407{
407408#ifdef YOUTUBE_ENABLED
408409 // when account is already connected:
409- OAuthStreamKey *a = reinterpret_cast <OAuthStreamKey *>(auth.get ());
410+ OAuthStreamKey *a = dynamic_cast <OAuthStreamKey *>(auth.get ());
410411 if (a && service == a->service () && IsYouTubeService (a->service ())) {
411412 ui->connectedAccountLabel ->setVisible (true );
412413 ui->connectedAccountText ->setVisible (true );
0 commit comments