[meld] dirdiff: Handle bad column settings



commit 35a653d5ee567198047bf7a24cc3f07077a6e386
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sun Jan 9 07:40:58 2022 +1000

    dirdiff: Handle bad column settings

 meld/dirdiff.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/meld/dirdiff.py b/meld/dirdiff.py
index 7cdefc89..30e01822 100644
--- a/meld/dirdiff.py
+++ b/meld/dirdiff.py
@@ -18,6 +18,7 @@ import collections
 import copy
 import errno
 import functools
+import logging
 import os
 import shutil
 import stat
@@ -51,6 +52,8 @@ from meld.ui.util import map_widgets_into_lists
 if typing.TYPE_CHECKING:
     from meld.ui.pathlabel import PathLabel
 
+log = logging.getLogger(__name__)
+
 
 class StatItem(namedtuple('StatItem', 'mode size time')):
     __slots__ = ()
@@ -632,7 +635,11 @@ class DirDiff(Gtk.VBox, tree.TreeviewCommon, MeldDoc):
         for i, treeview in enumerate(self.treeview):
             last_column = treeview.get_column(0)
             for column_name, visible in columns:
-                current_column = self.columns_dict[i][column_name]
+                try:
+                    current_column = self.columns_dict[i][column_name]
+                except KeyError:
+                    log.warning(f"Invalid column {column_name} in settings")
+                    continue
                 current_column.set_visible(visible)
                 treeview.move_column_after(current_column, last_column)
                 last_column = current_column


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]