Skip to content

Commit

Permalink
[desk-tool] Add guard for missing annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
mariuslundgard authored and rexxars committed Oct 6, 2020
1 parent aa12ece commit 3b8c2a4
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@ export function StringSegment({
const userColorManager = useUserColorManager()

if (segment.type === 'added') {
const color = getAnnotationColor(userColorManager, segment.annotation)
if (!segment.annotation) {
console.error('@todo: why are we missing annotation for added string segment?')
}

const color = segment.annotation
? getAnnotationColor(userColorManager, segment.annotation)
: {bg: '#fcc', fg: '#f00'}

return (
<AnnotationTooltip annotation={segment.annotation}>
Expand Down

0 comments on commit 3b8c2a4

Please sign in to comment.