From 35f42523d5258ab09765c86edc634673889e06b2 Mon Sep 17 00:00:00 2001 From: Arthur Milchior Date: Mon, 28 Oct 2019 04:25:12 +0100 Subject: [PATCH] Ensuring value of sortBackwards is a Boolean As far as Python is concerned, this commit does not change anything at all. The purpose of this commit is to avoid a rare bug in AnkiDroid. https://github.com/ankidroid/Anki-Android/issues/5523 Indeed, because of hh.sortIndicatorChanged.connect(self.onSortChanged), onSortChanged may be called with the values 0 or 1 instead of True or False. Which means than the method getBoolean in Ankidroid may throw an exception, stating that the value is an integer and not a Boolean. --- aqt/browser.py | 1 + 1 file changed, 1 insertion(+) diff --git a/aqt/browser.py b/aqt/browser.py index f127e0c6e..d83e34cb3 100644 --- a/aqt/browser.py +++ b/aqt/browser.py @@ -701,6 +701,7 @@ class Browser(QMainWindow): hh.sectionMoved.connect(self.onColumnMoved) def onSortChanged(self, idx, ord): + ord = bool(ord) self.editor.saveNow(lambda: self._onSortChanged(idx, ord)) def _onSortChanged(self, idx, ord):