Skip to content

Commit

Permalink
fix(clidoc): do not process invalid json (#258)
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr authored Jan 11, 2021
1 parent d950e43 commit de456e0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions clidoc/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ func Generate(cmd *cobra.Command, args []string) error {
return err
}

if !gjson.ValidBytes(sidebar) {
return errors.New("sidebar file is not valid JSON")
}

var index int
gjson.GetBytes(sidebar, `Reference`).ForEach(func(key, value gjson.Result) bool {
if strings.Contains(value.Get("label").String(), "CLI") {
Expand Down

0 comments on commit de456e0

Please sign in to comment.