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.
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.