bilibili / DanmakuFlameMaster

Android开源弹幕引擎·烈焰弹幕使 ~
http://app.bilibili.com/
Apache License 2.0
9.54k stars 2.11k forks source link

Crash caused by null BaseDanmaku object created by DanmakuFactory.createDanmaku #235

Open tonybright opened 8 years ago

tonybright commented 8 years ago

java.lang.NullPointerException: Attempt to write to field 'java.lang.CharSequence master.flame.danmaku.danmaku.model.BaseDanmaku.text' on a null object reference

ImageSpan imgSpan = new ImageSpan(mContext, getDanmakuBitmap(danmakuBean.getCastCommentBean())); SpannableString danmakuSpanStr = new SpannableString("danmaku"); danmakuSpanStr.setSpan(imgSpan, 0, danmakuSpanStr.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);

    danmaku.text = danmakuSpanStr;
RazerGene commented 8 years ago

It shows that the variable danmaku is null. The variable danmaku is created by the code "mContext.mDanmakuFactory.createDanmaku(BaseDanmaku.TYPE_SCROLL_RL);", so you'd better check every variable in this word.