Error when applying target profiles
Hello.
I keep getting an error when I try to apply a target profile.

Full error text:
pyfa v2.51.0 EVE Data Version: 2232464 (2023-03-16 06:15:32)
OS version: Windows-10-10.0.19041-SP0 Python version: 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)] wxPython version: 4.0.6 (wxWidgets 3.0.5) SQLAlchemy version: 1.3.23 Logbook version: 1.5.3 Requests version: 2.28.1 Dateutil version: 2.8.2
####################
Traceback (most recent call last): File "gui\statsPane.py", line 139, in handler File "gui\contextMenu.py", line 116, in getMenu File "gui\contextMenu.py", line 265, in _baseGetSubMenu File "gui\builtinContextMenus\targetProfile\switcher.py", line 102, in getSubMenu File "gui\builtinContextMenus\targetProfile\switcher.py", line 96, in makeMenu File "gui\builtinContextMenus\targetProfile\switcher.py", line 91, in makeMenu File "gui\builtinContextMenus\targetProfile\switcher.py", line 49, in _addProfile wx._core.wxAssertionError: C++ assertion "Assert failure" failed at ....\src\common\stockitem.cpp(213) in wxGetStockLabel(): invalid stock item ID
The same thing happens when right clicking in the bottom right of the graph window to add a target profile.

Full error text:
pyfa v2.51.0 EVE Data Version: 2232464 (2023-03-16 06:15:32)
OS version: Windows-10-10.0.19041-SP0 Python version: 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)] wxPython version: 4.0.6 (wxWidgets 3.0.5) SQLAlchemy version: 1.3.23 Logbook version: 1.5.3 Requests version: 2.28.1 Dateutil version: 2.8.2
####################
Traceback (most recent call last): File "graphs\gui\lists.py", line 360, in spawnMenu File "gui\contextMenu.py", line 116, in getMenu File "gui\contextMenu.py", line 265, in _baseGetSubMenu File "gui\builtinContextMenus\targetProfile\adder.py", line 87, in getSubMenu File "gui\builtinContextMenus\targetProfile\adder.py", line 81, in makeMenu File "gui\builtinContextMenus\targetProfile\adder.py", line 77, in makeMenu File "gui\builtinContextMenus\targetProfile\adder.py", line 41, in _addProfile wx._core.wxAssertionError: C++ assertion "Assert failure" failed at ....\src\common\stockitem.cpp(213) in wxGetStockLabel(): invalid stock item ID
If anyone can provide assistance I would be grateful.
This issue is caused while creating the menu items to apply Target Profiles.
If you have Target Profiles which end with square brackets like [MyTarget], this will definetley cause the mentioned error. Square brackets are reserved for menu items to sort your profiles.
Removing the square brackets in your target profiles will likely fix this issue. If you use square brackets to sort your profiles like for example: [NPC] [Serpentis] Frigate [NPC] [Serpentis] Cruiser
Make sure the last one (which will the the actual name) won´t be in brackets like in the above example.
If you still encounter this issue or don´t use square brackets at all, please add a list of your target profile names. I´am adding a pull request to prompt a error message in case one created a target profile with the last word in square brackets to avoid other capsuleers encounter this.
Fly safe!