From e242856e39091f99405e199fec638d8bd27c53a9 Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Sun, 8 Jul 2018 18:24:48 +0200 Subject: Fix crash for >32767 log files (fixes #10) --- elogv | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/elogv b/elogv index e579e01..3b174c5 100755 --- a/elogv +++ b/elogv @@ -498,6 +498,12 @@ class ElogViewer: else: self.packages.sort(key=self.get_packages_key, reverse=self.sort_method[1]) + # Curses' newpad fails for nlines >32767 so we truncate the list + # of log files to not exceed that limit (issue #10) + MAX_ENTRIES = 2 ** 15 - 1 + if len(self.packages) > MAX_ENTRIES: + self.packages = self.packages[:MAX_ENTRIES] + self.file_pad = curses.newpad(len(self.packages),self.width) self.file_pad.erase() -- cgit v1.2.3-65-gdbad