gonfunko / scratch-gui

Graphical User Interface for creating and running Scratch 3.0 projects.
https://scratchfoundation.github.io/scratch-gui/develop/
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

fix: prevent exception when switching languages #27

Closed gonfunko closed 1 month ago

gonfunko commented 1 month ago

This PR fixes an exception being thrown when switching languages. When the toolbox is refreshed, we attempt to maintain the relative scroll position in the flyout. Unfortunately, this is based on determining the (human-readable) name of the selected toolbox category, which is usually different (and therefore not present) when switching languages. This resulted in an attempt to access .y on a null object, with predictable results. Now, we check for null first. This does mean that we don't preserve the flyout scroll position when switching languages, but this is consistent with Scratch's existing behavior.