aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/EtiReader.cpp8
-rw-r--r--src/EtiReader.h1
2 files changed, 9 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;
diff --git a/src/EtiReader.h b/src/EtiReader.h
index 136bd1c..b893f01 100644
--- a/src/EtiReader.h
+++ b/src/EtiReader.h
@@ -91,6 +91,7 @@ private:
size_t myCurrentFrame;
bool time_ext_enabled;
unsigned long timestamp_seconds;
+ bool eti_fc_valid;
};