From 71912f0564c92889484ef9f69e6cf201b229f2c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Mon, 23 Jun 2014 09:48:30 +0200 Subject: [PATCH] [klipper] Prevent crash in History::trim if max size is 0 Top would point to an invalid item if the max size is 0. --- klipper/history.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/klipper/history.cpp b/klipper/history.cpp index 823aa36cd..7c9a68f72 100644 --- a/klipper/history.cpp +++ b/klipper/history.cpp @@ -92,6 +92,10 @@ void History::trim() { if (m_items.size()<=1) { m_nextCycle = 0L; } + if (m_items.isEmpty()) { + // force top to nullptr + m_top = nullptr; + } emit changed(); }