From fc61172a552c6cebd9d6198ef517d66e0c06bae7 Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Tue, 24 Aug 2021 13:42:21 -0400 Subject: [PATCH] 2021-08-24 Fred Gleason * Fixed a bug in rdlogmanager(1) that would cause a segfault when a cart was dropped in a Pre- or Post-Import list beneath the '--End of List--' marker. Signed-off-by: Fred Gleason --- ChangeLog | 4 ++++ rdlogmanager/importcartsmodel.cpp | 3 +++ 2 files changed, 7 insertions(+) diff --git a/ChangeLog b/ChangeLog index 34b85b9e..57532636 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22340,3 +22340,7 @@ struct in the rd_listsystemsettings(7) man page. 2021-08-24 Fred Gleason * Fixed a bug in caed(8) that broke the build. +2021-08-24 Fred Gleason + * Fixed a bug in rdlogmanager(1) that would cause a segfault when + a cart was dropped in a Pre- or Post-Import list beneath the + '--End of List--' marker. diff --git a/rdlogmanager/importcartsmodel.cpp b/rdlogmanager/importcartsmodel.cpp index 8ac7618d..8df998f9 100644 --- a/rdlogmanager/importcartsmodel.cpp +++ b/rdlogmanager/importcartsmodel.cpp @@ -388,6 +388,9 @@ QModelIndex ImportCartsModel::processCartDrop(int line,RDLogLine *ll) { int prev_len=totalLength(); + if(line<0) { + line=lineCount(); + } if(ll->cartNumber()==0) { // Remove line if(line>=lineCount()) { // Don't remove the end marker! return QModelIndex();