From 34ed5ac9ceda7d58cb0a39a662d1e821a30030f6 Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Tue, 1 Aug 2017 18:15:26 +0300 Subject: [PATCH] [fbreader] Fixed crash in ZLTextModel::addText with certain models --- fbreader/fbreader/zlibrary/text/src/model/ZLTextModel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fbreader/fbreader/zlibrary/text/src/model/ZLTextModel.cpp b/fbreader/fbreader/zlibrary/text/src/model/ZLTextModel.cpp index 3b196d1..a221b0e 100644 --- a/fbreader/fbreader/zlibrary/text/src/model/ZLTextModel.cpp +++ b/fbreader/fbreader/zlibrary/text/src/model/ZLTextModel.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2004-2010 Geometer Plus - * Copyright (C) 2015 Slava Monich + * Copyright (C) 2015-2017 Slava Monich * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -187,7 +187,7 @@ void ZLTextModel::addText(const std::vector &text) { memcpy(myLastEntryStart + offset, it->data(), it->length()); offset += it->length(); } - } else { + } else if (!myParagraphs.empty()) { myLastEntryStart = myAllocator.allocate(len + sizeof(size_t) + 1); *myLastEntryStart = ZLTextParagraphEntry::TEXT_ENTRY; memcpy(myLastEntryStart + 1, &len, sizeof(size_t));