Skip to content

Commit

Permalink
Fix bug parsing missing JSON field.
Browse files Browse the repository at this point in the history
  • Loading branch information
hscells committed Dec 1, 2020
1 parent 35c9365 commit c4e8b57
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions plugin/queryvis/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,13 @@ func (QueryVisPlugin) Serve(s searchrefiner.Server, c *gin.Context) {
rawQuery = content.Data["query"]
lang = content.Data["lang"]
var rel []combinator.Document
err = json.Unmarshal([]byte(content.Data["seeds"]), &rel)
if err != nil {
c.String(http.StatusOK, err.Error())
panic(err)
return
if _, ok := content.Data["seeds"]; ok {
err = json.Unmarshal([]byte(content.Data["seeds"]), &rel)
if err != nil {
c.String(http.StatusOK, err.Error())
panic(err)
return
}
}
tokenCache.Set(token, cachedItem{
query: rawQuery,
Expand Down

0 comments on commit c4e8b57

Please sign in to comment.