Skip to content
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.

Commit

Permalink
fix(snippet): gracefully handle missing snippet attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
rayrutjes committed Apr 10, 2017
1 parent 3976dca commit d888f97
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/vue-instantsearch-snippet/src/Snippet.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
const attributeName = ctx.props.attributeName
const tagName = ctx.props.tagName
if (!result._snippetResult || !result._snippetResult[attributeName]) {
throw new Error(`Attribute ${attributeName} has no snippet.`)
let attributeValue = ''
if (result._snippetResult && result._snippetResult[attributeName]) {
attributeValue = result._snippetResult[attributeName].value
}
let attributeValue = result._snippetResult[attributeName].value
if (ctx.props.escapeHtml === true) {
attributeValue = escapeHtml(attributeValue)
}
Expand Down

0 comments on commit d888f97

Please sign in to comment.