Markwon icon indicating copy to clipboard operation
Markwon copied to clipboard

AsyncDrawable crash NullPointerException

Open hijunmeng opened this issue 3 years ago • 1 comments

  • Markwon version: 4.6.2

i use markwon in RecyclerView,sometimes crash ,but cannot reproduce

java.lang.NullPointerException: Attempt to invoke virtual method 'void android.graphics.drawable.Drawable.void setBounds(android.graphics.Rect)(android.graphics.Rect)' on a null object reference at io.noties.markwon.image.AsyncDrawable.void initBounds()(AsyncDrawable.java:280) at io.noties.markwon.image.AsyncDrawable.void initWithKnownDimensions(int,float)(AsyncDrawable.java:319) at io.noties.markwon.image.AsyncDrawableSpan.void draw(android.graphics.Canvas,java.lang.CharSequence,int,int,float,int,int,int,android.graphics.Paint)(AsyncDrawableSpan.java:104) at android.text.TextLine.null handleReplacement(null)(TextLine.java:1011) at android.text.TextLine.null handleRun(null)(TextLine.java:1158) at android.text.TextLine.null drawRun(null)(TextLine.java:491) at android.text.TextLine.null draw(null)(TextLine.java:286) at android.text.Layout.null drawText(null)(Layout.java:576) at android.text.Layout.null draw(null)(Layout.java:324) at android.widget.TextView.null onDraw(null)(TextView.java:8013)

hijunmeng avatar Sep 30 '21 06:09 hijunmeng

Hello @hijunmeng ,

this seems like a bug, as initBounds could be called without having a result drawable, which can lead to a NullPointerException

noties avatar Dec 06 '21 22:12 noties