[Kst] branches/kst/hfi_calib/kst/src/libkstmath

George Staikos staikos at kde.org
Thu Jun 22 17:27:55 CEST 2006


SVN commit 553943 by staikos:

don't allow nulls in input vectors


 M  +3 -0      kstdataobject.cpp  
 M  +5 -3      kstpsd.cpp  


--- branches/kst/hfi_calib/kst/src/libkstmath/kstdataobject.cpp #553942:553943
@@ -26,6 +26,8 @@
 #include <qdeepcopy.h>
 #include <qtimer.h>
 
+#include <assert.h>
+
 #include "ksdebug.h"
 #include <klocale.h>
 
@@ -105,6 +107,7 @@
   for (i = _inputVectorLoadQueue.begin(); i != _inputVectorLoadQueue.end(); ++i) {
     KstVectorList::Iterator it = KST::vectorList.findTag((*i).second);
     if (it != KST::vectorList.end()) {
+      assert(*it);
       _inputVectors.insert((*i).first, *it);
     } else {
       KstDebug::self()->log(i18n("Unable to find required vector [%1] for data object %2.").arg((*i).second).arg(tagName()), KstDebug::Error);
--- branches/kst/hfi_calib/kst/src/libkstmath/kstpsd.cpp #553942:553943
@@ -136,7 +136,9 @@
 
   _typeString = i18n("Power Spectrum");
   _type = "PowerSpectrum";
-  _inputVectors[INVECTOR] = in_V;
+  if (in_V) {
+    _inputVectors[INVECTOR] = in_V;
+  }
   setTagName(in_tag);
   _Freq = in_freq;
   _Average = in_average;
@@ -152,8 +154,8 @@
   _Output = in_output;
   _interpolateHoles = interpolateHoles;
   
-  if (!_Average && _inputVectors[INVECTOR]) {
-    _Len =  int(ceil(log(double(_inputVectors[INVECTOR]->length())) / log(2.0)));
+  if (!_Average && in_V) {
+    _Len =  int(ceil(log(double(in_V->length())) / log(2.0)));
   }
 
   if (_Len < 2) {


More information about the Kst mailing list