summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorning.zhang2012-07-24 05:45:45 (EDT)
committer dgao2012-07-24 05:45:45 (EDT)
commit976946eb2e72ed2b9716cabe17c8c31e84424bef (patch)
treeff5400f560979e4b17d84818b6d3e513e8667c90
parent336ae77a6fa1e561d403912157bcfba860257477 (diff)
downloadorg.eclipse.birt-976946eb2e72ed2b9716cabe17c8c31e84424bef.zip
org.eclipse.birt-976946eb2e72ed2b9716cabe17c8c31e84424bef.tar.gz
org.eclipse.birt-976946eb2e72ed2b9716cabe17c8c31e84424bef.tar.bz2
Fixed an NPE.
-rw-r--r--UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/dialogs/ExpressionTreeSupport.java19
1 files changed, 17 insertions, 2 deletions
diff --git a/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/dialogs/ExpressionTreeSupport.java b/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/dialogs/ExpressionTreeSupport.java
index c4d0faa..1becb00 100644
--- a/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/dialogs/ExpressionTreeSupport.java
+++ b/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/dialogs/ExpressionTreeSupport.java
@@ -476,9 +476,14 @@ public class ExpressionTreeSupport implements ISelectionChangedListener
protected void saveSelection( TreeItem selection )
{
+ Memento memento = ( (Memento) viewerMemento.getChild( getElementType( ) ) );
+ if (memento == null)
+ {
+ return;
+ }
+
MementoElement[] selectPath = createItemPath( selection );
- ( (Memento) viewerMemento.getChild( getElementType( ) ) ).getMementoElement( )
- .setAttribute( MementoElement.ATTRIBUTE_SELECTED, selectPath );
+ memento.getMementoElement( ).setAttribute( MementoElement.ATTRIBUTE_SELECTED, selectPath );
}
protected MementoElement[] createItemPath( TreeItem item )
@@ -1144,6 +1149,11 @@ public class ExpressionTreeSupport implements ISelectionChangedListener
public boolean addNode( Memento element, MementoElement[] nodePath )
{
+ if (element == null)
+ {
+ return false;
+ }
+
if ( nodePath != null && nodePath.length > 0 )
{
MementoElement memento = element.getMementoElement( );
@@ -1167,6 +1177,11 @@ public class ExpressionTreeSupport implements ISelectionChangedListener
public boolean removeNode( Memento element, MementoElement[] nodePath )
{
+ if(element == null)
+ {
+ return false;
+ }
+
if ( nodePath != null && nodePath.length > 0 )
{
MementoElement memento = element.getMementoElement( );