mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
Handle None from QApplication.desktop().screen()
This prevents a crash when Anki is open for multiple days. Reference: https://anki.tenderapp.com/discussions/ankidesktop/41879-qt-cannot-create-window-no-screens-available
This commit is contained in:
parent
a0c1b68b86
commit
e366b86af2
2 changed files with 4 additions and 0 deletions
|
@ -37,6 +37,7 @@ Henrik Giesel <hengiesel@gmail.com>
|
||||||
Michał Bartoszkiewicz <mbartoszkiewicz@gmail.com>
|
Michał Bartoszkiewicz <mbartoszkiewicz@gmail.com>
|
||||||
Sander Santema <github.com/sandersantema/>
|
Sander Santema <github.com/sandersantema/>
|
||||||
Thomas Brownback <https://github.com/brownbat/>
|
Thomas Brownback <https://github.com/brownbat/>
|
||||||
|
Andrew Gaul <andrew@gaul.org>
|
||||||
|
|
||||||
********************
|
********************
|
||||||
|
|
||||||
|
|
|
@ -302,6 +302,9 @@ class AnkiWebView(QWebEngineView):
|
||||||
if isMac:
|
if isMac:
|
||||||
return 1
|
return 1
|
||||||
screen = QApplication.desktop().screen()
|
screen = QApplication.desktop().screen()
|
||||||
|
if screen is None:
|
||||||
|
return 1
|
||||||
|
|
||||||
dpi = screen.logicalDpiX()
|
dpi = screen.logicalDpiX()
|
||||||
factor = dpi / 96.0
|
factor = dpi / 96.0
|
||||||
if isLin:
|
if isLin:
|
||||||
|
|
Loading…
Reference in a new issue