From 4aa571d5a09e7c114633dc046bb8a61044a05d63 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sun, 25 Oct 2020 11:45:27 +0100 Subject: cleanup: remove get_times() functions The function 1) was misnamed: it determined the time of the first selcted dive. 2) had only one caller. 3) would crash if there was no selected dive. Let's just fold the functionality into the caller. It's a one-liner anyway. Signed-off-by: Berthold Stoeger --- desktop-widgets/simplewidgets.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'desktop-widgets') diff --git a/desktop-widgets/simplewidgets.cpp b/desktop-widgets/simplewidgets.cpp index 6eaab2eef..943da56c3 100644 --- a/desktop-widgets/simplewidgets.cpp +++ b/desktop-widgets/simplewidgets.cpp @@ -193,9 +193,11 @@ void ShiftTimesDialog::buttonClicked(QAbstractButton *button) } ui.timeEdit->setTime(QTime(0, 0, 0, 0)); - when = get_times(); //get time of first selected dive - ui.currentTime->setText(get_dive_date_string(when)); - ui.shiftedTime->setText(get_dive_date_string(when)); + dive *d = first_selected_dive(); + if (d) { + ui.currentTime->setText(get_dive_date_string(d->when)); + ui.shiftedTime->setText(get_dive_date_string(d->when)); + } } void ShiftTimesDialog::changeTime() -- cgit v1.2.3-70-g09d2