From aeae0a141019575252e8042c7b366e79b927651f Mon Sep 17 00:00:00 2001 From: yuanho Date: Tue, 1 Oct 2024 14:14:54 -0600 Subject: [PATCH] check for null point exception --- .../idv/control/CrossSectionControl.java | 42 ++++++++++--------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/src/ucar/unidata/idv/control/CrossSectionControl.java b/src/ucar/unidata/idv/control/CrossSectionControl.java index 7c4358741..bc6564f92 100644 --- a/src/ucar/unidata/idv/control/CrossSectionControl.java +++ b/src/ucar/unidata/idv/control/CrossSectionControl.java @@ -1648,7 +1648,7 @@ public void crossSectionChanged() { CrossSectionSelector cs = getCrossSectionSelector(); doShare(SHARE_XSLINE, new Object[] { cs.getStartPoint(), cs.getEndPoint() }); - if(controlList.size() >=1){ + if(controlList != null && controlList.size() >=1){ for(CrossSectionControl csc: controlList.values()){ csc.csSelector = csSelector; csc.loadDataFromLine(); @@ -1890,24 +1890,26 @@ protected void loadDataFromLine() throws VisADException, RemoteException { } GridDataInstance gdi = getGridDataInstance(); - FieldImpl slice = gdi.sliceAlongLatLonLine( - points, - getSamplingModeValue( - getObjectStore().get(PREF_SAMPLING_MODE, - DEFAULT_SAMPLING_MODE))); - // apply smoothing - if (checkFlag(FLAG_SMOOTHING) - && !getSmoothingType().equals(LABEL_NONE)) { - slice = GridUtil.smooth(slice, getSmoothingType(), - getSmoothingFactor()); - } - // apply skip factor - if (getSkipValue() > 0) { - slice = GridUtil.subset(slice, getSkipValue() + 1, 1); - } - showWaitCursor(); - loadData(slice); - showNormalCursor(); + if(gdi != null) { + FieldImpl slice = gdi.sliceAlongLatLonLine( + points, + getSamplingModeValue( + getObjectStore().get(PREF_SAMPLING_MODE, + DEFAULT_SAMPLING_MODE))); + // apply smoothing + if (checkFlag(FLAG_SMOOTHING) + && !getSmoothingType().equals(LABEL_NONE)) { + slice = GridUtil.smooth(slice, getSmoothingType(), + getSmoothingFactor()); + } + // apply skip factor + if (getSkipValue() > 0) { + slice = GridUtil.subset(slice, getSkipValue() + 1, 1); + } + showWaitCursor(); + loadData(slice); + showNormalCursor(); + } } @@ -2882,7 +2884,7 @@ public void processNewDataV(List newChoices) myFlowCrossSectionControl.paramName = dc.getName(); myFlowCrossSectionControl.crossSectionView = crossSectionView; myFlowCrossSectionControl.init(dc, csSelector); - myFlowCrossSectionControl.initDone(); + //myFlowCrossSectionControl.initDone(); addDisplayable(myFlowCrossSectionControl.xsDisplay); addDisplayable(myFlowCrossSectionControl.vcsDisplay, crossSectionView);