AllYarnsAreBeautiful/ayab-desktop

[BUG] If "Default Knit Side Image" is checked in Preferences, the app crashes on startup

Closed this issue · 0 comments

Environment
AYAB software version: 1.0.0-dev (fb76f48)
Computer/OS: macOS 14.5
Knitting machine: —
AYAB hardware: —

Describe the bug

If the "Default Knit Side Image" checkbox is checked in Preferences, the app crashes on startup.

To Reproduce
Steps to reproduce the behavior:

  1. Launch AYAB
  2. Open the Preferences panel through the menu
  3. Check the checkbox named "Default Knit Side Image"
  4. Click "OK" to save the preferences
  5. Quit AYAB
  6. Re-launch AYAB: the app immediately exits.

When run from a terminal the following stack trace is dumped:

Traceback (most recent call last):
  File "/Users/jonathanperret/src/ayab-desktop/src/main/python/main/main.py", line 122, in <module>
    exit_code = appctxt.run()  # 5. Invoke run()
                ^^^^^^^^^^^^^
  File "/Users/jonathanperret/src/ayab-desktop/src/main/python/main/main.py", line 36, in run
    self.main_window.show()
    ^^^^^^^^^^^^^^^^
  File "/Users/jonathanperret/src/ayab-desktop/src/main/python/main/main.py", line 117, in main_window
    return GuiMain(self)
           ^^^^^^^^^^^^^
  File "/Users/jonathanperret/src/ayab-desktop/src/main/python/main/ayab/ayab.py", line 79, in __init__
    self.scene: Scene = Scene(self)
                        ^^^^^^^^^^^
  File "/Users/jonathanperret/src/ayab-desktop/src/main/python/main/ayab/scene.py", line 69, in __init__
    self.reverse()
  File "/Users/jonathanperret/src/ayab-desktop/src/main/python/main/ayab/scene.py", line 83, in reverse
    self.ayabimage.image = Transform.hflip(self.ayabimage.image)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jonathanperret/src/ayab-desktop/src/main/python/main/ayab/transforms.py", line 58, in hflip
    return image.transpose(Image.FLIP_LEFT_RIGHT)
           ^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'transpose'

To recover, one has to delete the preferences file, i.e. issue rm ~/Library/Preferences/com.ayab-knitting.ayab.plist (on macOS) or rm ~/.config/AYAB/ayab.conf (on Linux).

Expected behavior
The app should not crash on startup.