Steps to Reproduce
- Start the application
- Open the Project Explorer panel
- Right-click on an empty region (no file/folder selected)
Expected Behavior
The application should continue running normally. It should either do nothing or display a basic context menu.
Actual Behavior
Right-clicking without any selected item causes the application to crash.
Environment
- eSim version: Latest (master)
- OS: Windows (64-bit)
Cause
The current implementation of the context menu depends on selectedIndexes() and assumes that a selection is always present.
When the selection is empty:
- Attempting to access the first index results in an error
- Some dependent variables may not get assigned properly
Suggested Fix
Instead of relying on selection, determine the clicked item using indexAt(position) and verify it with index.isValid() before using it.
This ensures safe handling of clicks on empty areas.
Steps to Reproduce
Expected Behavior
The application should continue running normally. It should either do nothing or display a basic context menu.
Actual Behavior
Right-clicking without any selected item causes the application to crash.
Environment
Cause
The current implementation of the context menu depends on
selectedIndexes()and assumes that a selection is always present.When the selection is empty:
Suggested Fix
Instead of relying on selection, determine the clicked item using
indexAt(position)and verify it withindex.isValid()before using it.This ensures safe handling of clicks on empty areas.