From 2f5f012929bc157d982812804870e33e88c58fc5 Mon Sep 17 00:00:00 2001 From: schneider Date: Thu, 1 Sep 2016 22:45:07 +0100 Subject: [PATCH] fix(plotview): check return value of getSamples for export --- plotview.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plotview.cpp b/plotview.cpp index 7210d21..04b0734 100644 --- a/plotview.cpp +++ b/plotview.cpp @@ -280,8 +280,10 @@ void PlotView::exportSamples(std::shared_ptr src) for (index = start; index < end; index += step) { off_t length = std::min(step, end - index); auto samples = complexSrc->getSamples(index, length); - for (auto i = 0; i < length; i += decimation.value()) { - os.write((const char*)&samples[i], 8); + if (samples != nullptr) { + for (auto i = 0; i < length; i += decimation.value()) { + os.write((const char*)&samples[i], 8); + } } } }