From: Christian Heller <c.heller@plomlompom.de>
Date: Sat, 26 Oct 2024 13:34:39 +0000 (+0200)
Subject: Browser: Fix by_1st view crashing if nothing to sort.
X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/static/%7B%7B%20web_path%20%7D%7D/decks?a=commitdiff_plain;h=b56c3edb31ce8f28e5d02d80d9b8aa81be5d2243;p=stable_plom

Browser: Fix by_1st view crashing if nothing to sort.
---

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: