Bug 511247 - Tenbrushes shows an exception if a shortcut is pressed before opening a document
Summary: Tenbrushes shows an exception if a shortcut is pressed before opening a document
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Scripting (other bugs)
Version First Reported In: 5.2.13
Platform: NixOS Linux
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-10-28 00:20 UTC by cromachina
Modified: 2025-10-28 01:59 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description cromachina 2025-10-28 00:20:37 UTC
SUMMARY
Tenbrushes shows an exception if a shortcut is pressed before opening a document:
>  File "/nix/store/32971d6d6i9rgfg641vdfhklm726sliw-krita-unwrapped-5.2.13/share/krita/pykrita/>tenbrushes/tenbrushes.py", line 107, in activatePreset
>    preset = window.views()[0].currentBrushPreset()
>             ~~~~~~~~~~~~~~^^^
> 
> IndexError: list index out of range

STEPS TO REPRODUCE
1. Assign a key to a tenbrushes shortcut.
2. Press the key on the home window, with no documents open.

OBSERVED RESULT
Exception dialog box appears.

EXPECTED RESULT
Nothing happens.

SOFTWARE/OS VERSIONS
Operating System: NixOS 25.11
KDE Plasma Version: 6.4.5
KDE Frameworks Version: 6.19.0
Qt Version: 6.9.2
Kernel Version: 6.17.1-zen1 (64-bit)
Graphics Platform: X11
Processors: 24 × AMD Ryzen 9 3900X 12-Core Processor
Memory: 64 GiB of RAM (62.7 GiB usable)
Graphics Processor: AMD Radeon RX 7900 XTX

ADDITIONAL INFORMATION
The exception box can be closed an the program can continue normally.
Comment 1 Freya Lupen 2025-10-28 01:59:41 UTC
Git commit c2f0087c63ebc3fc41faa8e0beed2be7d68f0b73 by Freya Lupen.
Committed on 28/10/2025 at 01:57.
Pushed by freyalupen into branch 'master'.

Ten Brushes: Don't error when using with no image

Unfortunately the scripting API doesn't allow switching brush with
no image open, unlike the preset chooser.

M  +5    -6    plugins/python/tenbrushes/tenbrushes.py

https://invent.kde.org/graphics/krita/-/commit/c2f0087c63ebc3fc41faa8e0beed2be7d68f0b73