Browse Source

UI: Check if source is valid earlier

Shaolin 7 years ago
parent
commit
cfc2c1373d
1 changed files with 6 additions and 8 deletions
  1. 6 8
      UI/window-basic-main.cpp

+ 6 - 8
UI/window-basic-main.cpp

@@ -5679,14 +5679,13 @@ void OBSBasic::OpenSourceWindow()
 {
 	int monitor = sender()->property("monitor").toInt();
 	OBSSceneItem item = GetCurrentSceneItem();
+	if (!item)
+		return;
+
 	OBSSource source = obs_sceneitem_get_source(item);
 	QString text = QString::fromUtf8(obs_source_get_name(source));
-
 	QString title = QTStr("SourceWindow") + " - " + text;
 
-	if (!item)
-		return;
-
 	OpenProjector(obs_sceneitem_get_source(item), monitor, true, title);
 }
 
@@ -5701,14 +5700,13 @@ void OBSBasic::OpenSceneWindow()
 {
 	int monitor = sender()->property("monitor").toInt();
 	OBSScene scene = GetCurrentScene();
+	if (!scene)
+		return;
+
 	OBSSource source = obs_scene_get_source(scene);
 	QString text = QString::fromUtf8(obs_source_get_name(source));
-
 	QString title = QTStr("SceneWindow") + " - " + text;
 
-	if (!scene)
-		return;
-
 	OpenProjector(obs_scene_get_source(scene), monitor, true, title);
 }