projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix #1038 by catching invalid cursor ranges
[pulseview.git]
/
pv
/
toolbars
/
mainbar.cpp
diff --git
a/pv/toolbars/mainbar.cpp
b/pv/toolbars/mainbar.cpp
index 1879693d57a31c01bc87458f556d67dd01db7506..34b120fec11ce0ec14bf21f16cc717e7b9d74222 100644
(file)
--- a/
pv/toolbars/mainbar.cpp
+++ b/
pv/toolbars/mainbar.cpp
@@
-612,6
+612,13
@@
void MainBar::export_file(shared_ptr<OutputFormat> format, bool selection_only)
const uint64_t end_sample = (uint64_t)max(
(double)0, end_time.convert_to<double>() * samplerate);
const uint64_t end_sample = (uint64_t)max(
(double)0, end_time.convert_to<double>() * samplerate);
+ if ((start_sample == 0) && (end_sample == 0)) {
+ // Both cursors are negative and were clamped to 0
+ show_session_error(tr("Invalid Range"), tr("The cursors don't " \
+ "define a valid range of samples."));
+ return;
+ }
+
sample_range = make_pair(start_sample, end_sample);
} else {
sample_range = make_pair(0, 0);
sample_range = make_pair(start_sample, end_sample);
} else {
sample_range = make_pair(0, 0);