mirror of
https://github.com/ankitects/anki.git
synced 2025-09-21 07:22:23 -04:00
Check for division by zero when calculating browser aspect ratio (#2437)
This commit is contained in:
parent
f9126927b1
commit
de9e2cfc40
2 changed files with 7 additions and 5 deletions
|
@ -116,6 +116,7 @@ Daniel Tang <danielzgtg.opensource@gmail.com>
|
|||
Jack Pearson <github.com/jrpear>
|
||||
yellowjello <github.com/yellowjello>
|
||||
Ingemar Berg <github.com/ingemarberg>
|
||||
Ben Kerman <ben@kermanic.org>
|
||||
|
||||
********************
|
||||
|
||||
|
|
|
@ -153,7 +153,7 @@ class Browser(QMainWindow):
|
|||
restoreState(self, self._editor_state_key)
|
||||
|
||||
# responsive layout
|
||||
self.aspect_ratio = self.width() / self.height()
|
||||
self.aspect_ratio = self.width() / self.height() if self.height() != 0 else 0
|
||||
self.set_layout(self.mw.pm.browser_layout(), True)
|
||||
# disable undo/redo
|
||||
self.on_undo_state_change(mw.undo_actions_info())
|
||||
|
@ -234,12 +234,13 @@ class Browser(QMainWindow):
|
|||
self.form.splitter.setOrientation(Qt.Orientation.Horizontal)
|
||||
|
||||
def resizeEvent(self, event: QResizeEvent) -> None:
|
||||
aspect_ratio = self.width() / self.height()
|
||||
if self.height() != 0:
|
||||
aspect_ratio = self.width() / self.height()
|
||||
|
||||
if self.auto_layout:
|
||||
self.maybe_update_layout(aspect_ratio)
|
||||
if self.auto_layout:
|
||||
self.maybe_update_layout(aspect_ratio)
|
||||
|
||||
self.aspect_ratio = aspect_ratio
|
||||
self.aspect_ratio = aspect_ratio
|
||||
|
||||
QMainWindow.resizeEvent(self, event)
|
||||
|
||||
|
|
Loading…
Reference in a new issue