dankito / RichTextEditor

Rich text WYSIWYG editor for Android and JavaFX
Apache License 2.0
92 stars 36 forks source link

Crash related to net.dankito.utils.AsyncProducerConsumerQueue.consumerThread #36

Closed tised closed 4 years ago

tised commented 4 years ago

Hello, we are experiencing weird crash in firebase crash reports, maybe you'll be able to help us because I see references to your utils class

Fatal Exception: java.lang.NullPointerException: Callable returned null at io.reactivex.internal.functions.ObjectHelper.requireNonNull(ObjectHelper.java:39) at io.reactivex.internal.operators.observable.ObservableFromCallable.subscribeActual(ObservableFromCallable.java:43) at io.reactivex.Observable.subscribe(Observable.java:12267) at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeTask.run(ObservableSubscribeOn.java:96) at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:38) at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:26) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) at java.lang.Thread.run(Thread.java:764)

AsyncProducerConsumerQueue0 at java.lang.Object.wait(Object.java) at java.lang.Thread.parkFor$(Thread.java:2135) at sun.misc.Unsafe.park(Unsafe.java:358) at java.util.concurrent.locks.LockSupport.park(LockSupport.java:190) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2059) at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442) at net.dankito.utils.AsyncProducerConsumerQueue.consumerThread(AsyncProducerConsumerQueue.kt:108) at net.dankito.utils.AsyncProducerConsumerQueue$startConsumerThread$consumerThread$1.run(AsyncProducerConsumerQueue.kt:98) at java.lang.Thread.run(Thread.java:764)

dankito commented 4 years ago

It's a bit hard to narrow down the issue as the stack trace doesn't show the producer side.

But actually it can only be that place in JavaScriptExecutorBase.kt (fireHtmlChangedListenersQueue is of type AsyncProducerConsumerQueue):

    protected open fun fireHtmlChangedListenersAsync(html: String) {
        if (htmlChangedListeners.isNotEmpty()) {
            fireHtmlChangedListenersQueue.add(html)
        }
    }

So that would mean that editor's html somehow was null.

Still trying to figure out how this ever can happen (actually should never be the case).

Do you call RichTextEditor from Java and do you have any code in your application where you call RichTextEditor.setHtml(null) (that means do you call setHtml() with 'null' as parameter)?

tised commented 4 years ago

I think it's not relevant anymore so I'll close it