Skip to content

Commit

Permalink
fix: premature pointer reference
Browse files Browse the repository at this point in the history
  • Loading branch information
test user committed Apr 5, 2023
1 parent 8a71483 commit 6e51b85
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion pkg/config/cfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func Init(dryRun bool) (*Cfg, error) {
repoRoot, err := getGitRepoRoot()
if err != nil {
if dryRun {
CentralStore.gitRepoRoot = "."
cfg.gitRepoRoot = "."
} else {
// fatal since we need to look for configuration there
return nil, err
Expand Down Expand Up @@ -506,6 +506,10 @@ func EditCfgFileCmd(cfg *Cfg, defaultFileContent string) *exec.Cmd {
if err != nil {
log.Fatalf("unable to write to file: %v", err)
}
err = f.Close()
if err != nil {
log.Fatalf("unable to close file: %s : %v", cfgFile, err)
}
}
editCmd = append(editCmd, cfgFile)
cmd := exec.Command(editCmd[0], editCmd[1:]...)
Expand Down
2 changes: 1 addition & 1 deletion pkg/scope_selector/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) {
log.Fatal(msg.err)
}
if err := config.CentralStore.ReadCfgFile(true); err != nil {
log.Panicf("%+v", err)
log.Fatalf(">>%+v", err) // FIXME: handle this error
newScope := m.input.CurrentInput()
editorCmd := config.EditCfgFileCmd(
config.CentralStore,
Expand Down

0 comments on commit 6e51b85

Please sign in to comment.