aboutsummaryrefslogtreecommitdiffstats
path: root/src/EtiReader.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2015-04-10 16:39:14 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2015-04-10 16:39:14 +0200
commite2d14763b766b2154940a47acb3dffb65d0973d3 (patch)
tree262a857f03975a347c7129bca751b74334c29dbe /src/EtiReader.cpp
parent8270567bc62db8f94a6e142b3b170a3bb943c090 (diff)
downloaddabmod-e2d14763b766b2154940a47acb3dffb65d0973d3.tar.gz
dabmod-e2d14763b766b2154940a47acb3dffb65d0973d3.tar.bz2
dabmod-e2d14763b766b2154940a47acb3dffb65d0973d3.zip
Add validity check for eti_fc
Diffstat (limited to 'src/EtiReader.cpp')
-rw-r--r--src/EtiReader.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/EtiReader.cpp b/src/EtiReader.cpp
index 7e0df72..0e4182d 100644
--- a/src/EtiReader.cpp
+++ b/src/EtiReader.cpp
@@ -61,6 +61,7 @@ EtiReader::EtiReader(struct modulator_offset_config& modconf,
PDEBUG("EtiReader::EtiReader()\n");
myCurrentFrame = 0;
+ eti_fc_valid = false;
}
EtiReader::~EtiReader()
@@ -81,12 +82,18 @@ FicSource* EtiReader::getFic()
unsigned EtiReader::getMode()
{
+ if (not eti_fc_valid) {
+ throw std::runtime_error("Trying to access Mode before it is ready!");
+ }
return eti_fc.MID;
}
unsigned EtiReader::getFp()
{
+ if (not eti_fc_valid) {
+ throw std::runtime_error("Trying to access FP before it is ready!");
+ }
return eti_fc.FP;
}
@@ -144,6 +151,7 @@ int EtiReader::process(const Buffer* dataIn)
return dataIn->getLength() - input_size;
}
memcpy(&eti_fc, in, 4);
+ eti_fc_valid = true;
input_size -= 4;
framesize -= 4;
in += 4;