From 80ca8e70c92d4d74895ceb6b73855805c79fe36a Mon Sep 17 00:00:00 2001 From: Sebastian Thomschke Date: Fri, 8 Nov 2024 17:10:47 +0100 Subject: [PATCH] Fix NullPointerException in LogView This commit addresses an occasionally occurring NullPointerException in the LogView class: ``` LogListener.logged threw a non-fatal unchecked exception as follows: java.lang.NullPointerException: Cannot invoke "org.eclipse.jface.action.Action.isChecked()" because "this.fActivateViewAction" is null at org.eclipse.ui.internal.views.log.LogView.asyncRefreshAndActivate(LogView.java:1253) at org.eclipse.ui.internal.views.log.LogView.pushEntry(LogView.java:1212) at org.eclipse.ui.internal.views.log.LogView.logged(LogView.java:1143) at org.eclipse.osgi.internal.log.ExtendedLogReaderServiceFactory.safeLogged(ExtendedLogReaderServiceFactory.java:108) at org.eclipse.osgi.internal.log.ExtendedLogReaderServiceFactory$LogTask.run(ExtendedLogReaderServiceFactory.java:56) at org.eclipse.osgi.internal.log.OrderedExecutor$OrderedTaskQueue$OrderedTask.run(ExtendedLogReaderServiceFactory.java:458) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) at java.base/java.lang.Thread.run(Thread.java:1583) ``` --- .../src/org/eclipse/ui/internal/views/log/LogView.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bundles/org.eclipse.ui.views.log/src/org/eclipse/ui/internal/views/log/LogView.java b/bundles/org.eclipse.ui.views.log/src/org/eclipse/ui/internal/views/log/LogView.java index 4debe5f649a..91ca2536f3f 100644 --- a/bundles/org.eclipse.ui.views.log/src/org/eclipse/ui/internal/views/log/LogView.java +++ b/bundles/org.eclipse.ui.views.log/src/org/eclipse/ui/internal/views/log/LogView.java @@ -1250,8 +1250,9 @@ private Throttler createMutualActivate(Display display) { private void asyncRefreshAndActivate(int severity) { asyncRefresh(); - if ((fActivateViewAction.isChecked()) || (severity >= IStatus.WARNING && fActivateViewWarnAction.isChecked()) - || (severity >= IStatus.ERROR && fActivateViewErrorAction.isChecked())) { + if ((fActivateViewAction != null && fActivateViewAction.isChecked()) + || (severity >= IStatus.WARNING && fActivateViewWarnAction != null && fActivateViewWarnAction.isChecked()) + || (severity >= IStatus.ERROR && fActivateViewErrorAction != null && fActivateViewErrorAction.isChecked())) { mutualActivate.throttledExec(); } }