Skip to content

Commit 0d8564f

Browse files
committed
[widget] don’t panic but log an error about an unexpected state
1 parent 9926a81 commit 0d8564f

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

widget/richtext.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -996,13 +996,10 @@ func ellipsisPriorBound(bounds []rowBoundary, trunc fyne.TextTruncation, width f
996996
}
997997

998998
prior := bounds[len(bounds)-1]
999-
// TODO:
1000-
// To ignore the assertion failure here seems dangerous, therefore I added an explicit panic.
1001-
// However, I was not able to force a failure.
1002-
// Someone with insight to the whole rich-text stuff should analyze this.
1003999
seg, ok := prior.segments[0].(*TextSegment)
10041000
if !ok {
1005-
panic(fmt.Sprintf("unexpected rich text segment: %#v", prior.segments[0]))
1001+
fyne.LogError(fmt.Sprintf("unexpected rich text segment: %#v", prior.segments[0]), nil)
1002+
return bounds
10061003
}
10071004

10081005
ellipsisSize := fyne.MeasureText("…", seg.size(), seg.Style.TextStyle) //revive:disable-line:add-constant

0 commit comments

Comments
 (0)