diff --git a/CHANGELOG.md b/CHANGELOG.md index 254d6a926a..c73ea856e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,7 @@ release. ### Fixed - Updated README.md to remove remaining references to downloading data from discontinued rsync server [#5152](https://github.com/DOI-USGS/ISIS3/issues/5152) - Fixed users not being able to modify planetographic projections in qmos +- Modified spice::readValue to add check for numValuesRead to stop reading garbase values [#4928](https://github.com/USGS-Astrogeology/ISIS3/issues/4928) ## [7.2.0] - 2022-12-07 diff --git a/isis/src/base/objs/Spice/Spice.cpp b/isis/src/base/objs/Spice/Spice.cpp index 65b171f6de..bc837a8a27 100644 --- a/isis/src/base/objs/Spice/Spice.cpp +++ b/isis/src/base/objs/Spice/Spice.cpp @@ -1118,7 +1118,7 @@ namespace Isis { gdpool_c(key.toLatin1().data(), (SpiceInt)index, 1, &numValuesRead, &kernelValue, &found); - if (found) + if (found && numValuesRead > 0) result = kernelValue; } else if (type == SpiceStringType) { @@ -1126,7 +1126,7 @@ namespace Isis { gcpool_c(key.toLatin1().data(), (SpiceInt)index, 1, sizeof(kernelValue), &numValuesRead, kernelValue, &found); - if (found) + if (found && numValuesRead > 0) result = kernelValue; } else if (type == SpiceIntType) { @@ -1134,7 +1134,7 @@ namespace Isis { gipool_c(key.toLatin1().data(), (SpiceInt)index, 1, &numValuesRead, &kernelValue, &found); - if (found) + if (found && numValuesRead > 0) result = (int)kernelValue; } @@ -1142,6 +1142,10 @@ namespace Isis { QString msg = "Can not find [" + key + "] in text kernels"; throw IException(IException::Io, msg, _FILEINFO_); } + else if (numValuesRead == 0){ + QString msg = "Found " + key + "] in text kernels, but no values were identified and read."; + throw IException(IException::Io, msg, _FILEINFO_); + } storeValue(key, index, type, result); NaifStatus::CheckErrors();