Skip to content

Commit ef046ac

Browse files
committed
Sentry fix: protect from null project scale, and handle project scale consistently
1 parent 5e26cc7 commit ef046ac

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/windows/main_window.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2795,7 +2795,7 @@ def setup_toolbars(self):
27952795
self.caption_model_row = None
27962796

27972797
# Get project's initial zoom value
2798-
initial_scale = get_app().project.get("scale") or 15.0
2798+
initial_scale = float(get_app().project.get("scale") or 15.0)
27992799

28002800
# Setup Zoom Slider widget
28012801
from windows.views.zoom_slider import ZoomSlider

src/windows/views/webview.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ def changed(self, action):
230230
# Reset the scale when loading new JSON
231231
if action.type == "load":
232232
# Set the scale again (to project setting)
233-
initial_scale = get_app().project.get("scale") or 15.0
233+
initial_scale = float(get_app().project.get("scale") or 15.0)
234234
self.window.sliderZoomWidget.setZoomFactor(initial_scale)
235235

236236
@pyqtSlot(str, bool, bool, bool)
@@ -2829,7 +2829,7 @@ def update_zoom(self, newScale):
28292829
self.redraw_audio_timer.start()
28302830

28312831
# Only update scale if different
2832-
current_scale = float(get_app().project.get("scale"))
2832+
current_scale = float(get_app().project.get("scale") or 15.0)
28332833

28342834
# Save current zoom
28352835
if newScale != current_scale:

0 commit comments

Comments
 (0)