summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2018-08-18 19:43:58 +1000
committerJesse Duffield <jessedduffield@gmail.com>2018-08-18 19:43:58 +1000
commit1f756d3d0a14014dedc6dc22e24c5e5ac5261e94 (patch)
treea9c7affc854feb02e67bfe04c1b7e43a1f0c7da3
parent6473e5ca3cb727d3f6f4cbe132495532a8bfbc0c (diff)
avoid nil pointer reference on startup
-rw-r--r--main.go8
-rw-r--r--pkg/app/app.go8
2 files changed, 11 insertions, 5 deletions
diff --git a/main.go b/main.go
index 9bbf0eec1..b8b9af931 100644
--- a/main.go
+++ b/main.go
@@ -53,7 +53,13 @@ func main() {
}
app, err := app.NewApp(appConfig)
- app.Log.Info(err)
+ if err != nil {
+ // TODO: remove this call to panic after anonymous error reporting
+ // is setup (right now the call to panic logs nothing to the screen which
+ // would make debugging difficult
+ panic(err)
+ // app.Log.Panic(err.Error())
+ }
app.GitCommand.SetupGit()
app.Gui.RunWithSubprocesses()
}
diff --git a/pkg/app/app.go b/pkg/app/app.go
index 98da0b0fa..aaa925e53 100644
--- a/pkg/app/app.go
+++ b/pkg/app/app.go
@@ -48,21 +48,21 @@ func NewApp(config config.AppConfigurer) (*App, error) {
app.Log = newLogger(config)
app.OSCommand, err = commands.NewOSCommand(app.Log)
if err != nil {
- return nil, err
+ return app, err
}
app.Tr, err = i18n.NewLocalizer(app.Log)
if err != nil {
- return nil, err
+ return app, err
}
app.GitCommand, err = commands.NewGitCommand(app.Log, app.OSCommand)
if err != nil {
- return nil, err
+ return app, err
}
app.Gui, err = gui.NewGui(app.Log, app.GitCommand, app.OSCommand, app.Tr, config)
if err != nil {
- return nil, err
+ return app, err
}
return app, nil
}