From b56c3edb31ce8f28e5d02d80d9b8aa81be5d2243 Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Sat, 26 Oct 2024 15:34:39 +0200
Subject: [PATCH] Browser: Fix by_1st view crashing if nothing to sort.

---
 browser.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/browser.py b/browser.py
index 939dc1a..31f146e 100755
--- a/browser.py
+++ b/browser.py
@@ -840,6 +840,9 @@ class Gallery:
                     vals = self.items_attrs[sorter.name]['incl']
                     if len(vals) > 1:
                         sort_attrs += [(sorter.name, vals)]
+                if not sort_attrs:
+                    s_name = self._sort_order[0].name
+                    sort_attrs += [(s_name, self.items_attrs[s_name]['incl'])]
                 self._per_row = len(sort_attrs[-1][1])
                 build_rows_by_attrs(sort_attrs, entries_filtered, [])
             else:
-- 
2.30.2