SwitchyOmega icon indicating copy to clipboard operation
SwitchyOmega copied to clipboard

Fix popup show no profile

Open yoshino-s opened this issue 2 years ago • 2 comments

What does this PR do?

  • [x] Bug fix [#2337]
  • [ ] Improvement
  • [ ] New feature

(Note: Translations and typo fixes should be done on https://hosted.weblate.org/projects/switchyomega/ instead of PR.)

In some case there may be no profile shown in popup menu like

776769539a6d95448135782a5f74ebd

And we can find error like this

Uncaught TypeError: Cannot read properties of undefined (reading 'FixedProfile')
    at compareProfile (profiles.js:43:25)
    at Array.sort (<anonymous>)
    at addProfilesItems (profiles.js:145:8)
    at updateMenuByState (profiles.js:36:5)
    at v.ready (script.min.js:formatted:95:14)
    at profiles.js:2:11
    at profiles.js:283:3

Ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/var#var_hoisting

Compatibility

  • Is this PR compatible with old versions? Y
  • Can users simply upgrade the extension? Y

yoshino-s avatar Dec 06 '22 08:12 yoshino-s