After upgrading from v1.7.2 to v1.8.0, the app crashes on startup in portable mode if the existing SmartContextMenu.xml (from v1.7.2) does not contain the newly added <mover> section. Portable config via SmartContextMenu.xml is documented/expected behavior.
Steps to reproduce
- Use SmartContextMenu v1.8.0 in portable mode with an existing v1.7.2
SmartContextMenu.xml that doesn’t include <mover>.
- Launch it
Actual behavior
System.NullReferenceException: Object reference not set to an instance of an object.
at SmartContextMenu.Settings.ApplicationSettingsFile.ReadShortcut(XElement element)
at SmartContextMenu.Settings.ApplicationSettingsFile.Read(Stream stream)
at SmartContextMenu.Settings.ApplicationSettingsFile.ReadFromCurrentDirectoryFile()
at SmartContextMenu.Program.Main(String[] args)
Cause
When upgrading from v1.7.2 portable config, the XML may not include <mover>. In that case XPathSelectElement("/smartContextMenu/mover/next") returns null, and ReadShortcut dereferences element.Attribute(...), causing the NullReferenceException.
Possible fix
Add if (element == null) return new KeyboardShortcut(); in ReadShortcut().