Kaydet (Commit) 77031644 authored tarafından jan iversen's avatar jan iversen

cid#1326434, 1326446, 1326248, 1326254

null pointer dereferencing, added null check

Change-Id: I78f3ee1eb5d5bd4ebe7b3a6775db4884859dbcf6
Reviewed-on: https://gerrit.libreoffice.org/21712Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarjan iversen <jani@documentfoundation.org>
üst b9961075
...@@ -587,7 +587,8 @@ public class utils { ...@@ -587,7 +587,8 @@ public class utils {
} catch (com.sun.star.uno.Exception e) { } catch (com.sun.star.uno.Exception e) {
} }
xTrans.parseStrict(rUrl); if (xTrans != null)
xTrans.parseStrict(rUrl);
return rUrl[0]; return rUrl[0];
} }
......
...@@ -137,12 +137,18 @@ public class _XTreeNode extends MultiMethodTest { ...@@ -137,12 +137,18 @@ public class _XTreeNode extends MultiMethodTest {
} }
log.println("try to get parrent of children"); log.println("try to get parrent of children");
XTreeNode xParrent = xNode.getParent(); if (xNode == null) {
log.println("missing xNode");
tRes.tested("getParent()", false);
}
else {
XTreeNode xParrent = xNode.getParent();
bOK = oObj.equals(xParrent); bOK = oObj.equals(xParrent);
log.println("original object and parrent should be the same: " + bOK); log.println("original object and parrent should be the same: " + bOK);
tRes.tested("getParent()", bOK); tRes.tested("getParent()", bOK);
}
} }
......
...@@ -164,7 +164,8 @@ public class _DrawingDocumentDrawView extends MultiPropertyTest { ...@@ -164,7 +164,8 @@ public class _DrawingDocumentDrawView extends MultiPropertyTest {
} }
log.println("oldZoomValue: "+oldValue); log.println("oldZoomValue: "+oldValue);
log.println("newZoomValue: "+newValue); log.println("newZoomValue: "+newValue);
tRes.tested("ZoomType",(!oldValue.equals(newValue))); if (oldValue != null)
tRes.tested("ZoomType",(!oldValue.equals(newValue)));
} }
} }
......
...@@ -60,40 +60,40 @@ public class MainThreadDialogExecutor implements XCallback ...@@ -60,40 +60,40 @@ public class MainThreadDialogExecutor implements XCallback
private static boolean GetCallback( XComponentContext xContext, MainThreadDialogExecutor aExecutor ) private static boolean GetCallback( XComponentContext xContext, MainThreadDialogExecutor aExecutor )
{ {
if (aExecutor == null)
return false;
try try
{ {
if ( aExecutor != null ) String aThreadName = null;
{ Thread aCurThread = Thread.currentThread();
String aThreadName = null; if ( aCurThread != null )
Thread aCurThread = Thread.currentThread(); aThreadName = aCurThread.getName();
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 xRequest.addCallback( aExecutor, Any.VOID );
XMultiComponentFactory xFactory = xContext.getServiceManager(); do
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 ); Thread.yield();
do
{
Thread.yield();
}
while( !aExecutor.m_bCalled );
} }
while( !aExecutor.m_bCalled );
} }
else }
{ else
// handle it as a main thread {
aExecutor.notify( Any.VOID ); // handle it as a main thread
} aExecutor.notify( Any.VOID );
} }
} }
catch( Exception e ) catch( Exception e )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment