From 35af96b6224285ba7219a7ce4dbbd86439aa01a8 Mon Sep 17 00:00:00 2001 From: dreamsourcelabTAI Date: Mon, 8 Jan 2024 15:32:34 +0800 Subject: [PATCH] fix: the search cursor able move out off range --- DSView/pv/view/timemarker.cpp | 5 ++++- DSView/pv/view/timemarker.h | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/DSView/pv/view/timemarker.cpp b/DSView/pv/view/timemarker.cpp index 0a6b049b..2fba38f2 100644 --- a/DSView/pv/view/timemarker.cpp +++ b/DSView/pv/view/timemarker.cpp @@ -72,8 +72,11 @@ uint64_t TimeMarker::index() return _index; } -void TimeMarker::set_index(uint64_t index) +void TimeMarker::set_index(int64_t index) { + if (index < 0){ + index = 0; + } _index = index; time_changed(); } diff --git a/DSView/pv/view/timemarker.h b/DSView/pv/view/timemarker.h index 84cc0bcb..7cbe8136 100644 --- a/DSView/pv/view/timemarker.h +++ b/DSView/pv/view/timemarker.h @@ -66,7 +66,7 @@ public: /** * Sets the time of the marker. */ - void set_index(uint64_t index); + void set_index(int64_t index); /** * Gets/Sets colour of the marker