Browse Source

added panic catch for gui

0xdcarns 3 years ago
parent
commit
0937f416ba
1 changed files with 6 additions and 5 deletions
  1. 6 5
      netclient/gui/gui.go

+ 6 - 5
netclient/gui/gui.go

@@ -22,6 +22,11 @@ var logoContent embed.FS
 
 // Run - run's the netclient GUI
 func Run(networks []string) error {
+	defer func() {
+		if r := recover(); r != nil {
+			logger.Log(0, "No monitor detected, please use CLI commands; use -help for more info.")
+		}
+	}()
 	a := app.New()
 	window := a.NewWindow("Netclient - " + ncutils.Version)
 
@@ -100,11 +105,7 @@ func Run(networks []string) error {
 	views.CurrentContent.Add(views.GetView(views.Join))
 
 	window.SetContent(views.CurrentContent)
-	defer func() {
-		if r := recover(); r != nil {
-			logger.Log(0, "No monitor detected, please use CLI commands; use -help for more info.")
-		}
-	}()
 	window.ShowAndRun()
+
 	return nil
 }