1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-01-04 03:48:07 +02:00

avoid nil pointer reference on startup

This commit is contained in:
Jesse Duffield 2018-08-18 19:43:58 +10:00
parent 6473e5ca3c
commit 1f756d3d0a
2 changed files with 11 additions and 5 deletions

View File

@ -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()
}

View File

@ -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
}