summaryrefslogtreecommitdiff
path: root/swext
diff options
context:
space:
mode:
authorjan iversen <jani@documentfoundation.org>2016-01-22 15:04:25 +0100
committerjan iversen <jani@documentfoundation.org>2016-01-23 08:31:46 +0000
commit77031644f16b63c794c1eef0ec4456d37e34fe23 (patch)
tree2854e011cef92b09a14a9c3eea7b23a5d94a709c /swext
parentb996107585efb7bed88351d2cea2e56d8500c2fb (diff)
null pointer dereferencing, added null check Change-Id: I78f3ee1eb5d5bd4ebe7b3a6775db4884859dbcf6 Reviewed-on: https://gerrit.libreoffice.org/21712 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: jan iversen <jani@documentfoundation.org>
Diffstat (limited to 'swext')
-rw-r--r--swext/mediawiki/src/com/sun/star/wiki/MainThreadDialogExecutor.java54
1 files changed, 27 insertions, 27 deletions
diff --git a/swext/mediawiki/src/com/sun/star/wiki/MainThreadDialogExecutor.java b/swext/mediawiki/src/com/sun/star/wiki/MainThreadDialogExecutor.java
index 784bc7774e11..a6ee07fc8504 100644
--- a/swext/mediawiki/src/com/sun/star/wiki/MainThreadDialogExecutor.java
+++ b/swext/mediawiki/src/com/sun/star/wiki/MainThreadDialogExecutor.java
@@ -60,40 +60,40 @@ public class MainThreadDialogExecutor implements XCallback
private static boolean GetCallback( XComponentContext xContext, MainThreadDialogExecutor aExecutor )
{
+ if (aExecutor == null)
+ return false;
+
try
{
- if ( aExecutor != null )
- {
- String aThreadName = null;
- Thread aCurThread = Thread.currentThread();
- if ( aCurThread != null )
- aThreadName = aCurThread.getName();
+ String aThreadName = null;
+ Thread aCurThread = Thread.currentThread();
+ if ( aCurThread != null )
+ aThreadName = aCurThread.getName();
- if ( aThreadName != null && aThreadName.equals( "com.sun.star.thread.WikiEditorSendingThread" ) )
+ if ( aThreadName != null && aThreadName.equals( "com.sun.star.thread.WikiEditorSendingThread" ) )
+ {
+ // the main thread should be accessed asynchronously
+ XMultiComponentFactory xFactory = xContext.getServiceManager();
+ if ( xFactory == null )
+ throw new com.sun.star.uno.RuntimeException();
+
+ XRequestCallback xRequest = UnoRuntime.queryInterface(
+ XRequestCallback.class,
+ xFactory.createInstanceWithContext( "com.sun.star.awt.AsyncCallback", xContext ) );
+ if ( xRequest != null )
{
- // the main thread should be accessed asynchronously
- XMultiComponentFactory xFactory = xContext.getServiceManager();
- if ( xFactory == null )
- throw new com.sun.star.uno.RuntimeException();
-
- XRequestCallback xRequest = UnoRuntime.queryInterface(
- XRequestCallback.class,
- xFactory.createInstanceWithContext( "com.sun.star.awt.AsyncCallback", xContext ) );
- if ( xRequest != null )
+ xRequest.addCallback( aExecutor, Any.VOID );
+ do
{
- xRequest.addCallback( aExecutor, Any.VOID );
- do
- {
- Thread.yield();
- }
- while( !aExecutor.m_bCalled );
+ Thread.yield();
}
+ while( !aExecutor.m_bCalled );
}
- else
- {
- // handle it as a main thread
- aExecutor.notify( Any.VOID );
- }
+ }
+ else
+ {
+ // handle it as a main thread
+ aExecutor.notify( Any.VOID );
}
}
catch( Exception e )