diff --git a/image-editor/lib/src/main/java/org/signal/imageeditor/core/renderers/MultiLineTextRenderer.java b/image-editor/lib/src/main/java/org/signal/imageeditor/core/renderers/MultiLineTextRenderer.java index 1b88904ae..14999ed30 100644 --- a/image-editor/lib/src/main/java/org/signal/imageeditor/core/renderers/MultiLineTextRenderer.java +++ b/image-editor/lib/src/main/java/org/signal/imageeditor/core/renderers/MultiLineTextRenderer.java @@ -320,10 +320,14 @@ public final class MultiLineTextRenderer extends InvalidateableRenderer implemen rendererContext.canvasMatrix.concat(projectionMatrix); if (mode == Mode.HIGHLIGHT) { - modeBounds.set(textBounds.left - HIGHLIGHT_HORIZONTAL_PADDING, - selectionBounds.top - HIGHLIGHT_TOP_PADDING, - textBounds.right + HIGHLIGHT_HORIZONTAL_PADDING, - selectionBounds.bottom + HIGHLIGHT_BOTTOM_PADDING); + if(text.isEmpty()){ + modeBounds.setEmpty(); + }else{ + modeBounds.set(textBounds.left - HIGHLIGHT_HORIZONTAL_PADDING, + selectionBounds.top - HIGHLIGHT_TOP_PADDING, + textBounds.right + HIGHLIGHT_HORIZONTAL_PADDING, + selectionBounds.bottom + HIGHLIGHT_BOTTOM_PADDING); + } int alpha = modePaint.getAlpha(); modePaint.setAlpha(rendererContext.getAlpha(alpha)); rendererContext.canvas.drawRoundRect(modeBounds, HIGHLIGHT_CORNER_RADIUS, HIGHLIGHT_CORNER_RADIUS, modePaint);