Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

πŸ”§βœ¨ Handle nil case for selectedDir and selectedDirCell (Interface Conversion Nil Error) #274

Merged
merged 1 commit into from
Feb 12, 2024

Conversation

ShivamB25
Copy link
Contributor

@ShivamB25 ShivamB25 commented Aug 21, 2023

This pull request addresses a potential issue in the fileItemSelected method by adding a nil check for selectedDir and selectedDirCell.

Changes

  • Added a check to handle the case when selectedDir and selectedDirCell are nil in the fileItemSelected method.
  • If either selectedDirCell or selectedDir is nil, the method now returns early.
  • This change prevents potential crashes that could occur when attempting to access properties of nil values.

Motivation

The main goal of this change is to improve the robustness of the application by handling edge cases where selectedDir or selectedDirCell might be nil. This prevents potential runtime errors and improves the overall stability of the program.

Implementation Details

The fileItemSelected method now includes an early return statement if either selectedDirCell or selectedDir is nil. This ensures that the method doesn't proceed with operations on potentially nil values, which could lead to crashes or unexpected behavior.

Testing

  • Tested the application with various scenarios where selectedDir or selectedDirCell might be nil.
  • Verified that the application no longer crashes in these edge cases.
  • Ensured that the existing functionality remains intact for normal use cases.

Notes for Reviewers

  • Please pay special attention to the nil check implementation and suggest any improvements if necessary.
  • Consider if there are any other methods that might benefit from similar nil checks.

This pull request aims to enhance the stability and reliability of the application by gracefully handling potential nil cases.

@ShivamB25 ShivamB25 changed the title Master fixes: Panic with Interface Conversion Nil Error Aug 21, 2023
@ShivamB25
Copy link
Contributor Author

ShivamB25 commented Aug 21, 2023

fixed #273

- Added a check to handle the case when `selectedDir` and `selectedDirCell` are nil in `fileItemSelected` method.
- If either `selectedDirCell` or `selectedDir` is nil, it returns early from the method.
- This change ensures that the program won't crash when trying to access properties of nil values.
Copy link

codecov bot commented Feb 12, 2024

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (3a0e577) 90.36% compared to head (d572a1f) 90.32%.

Files Patch % Lines
tui/tui.go 88.88% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #274      +/-   ##
==========================================
- Coverage   90.36%   90.32%   -0.05%     
==========================================
  Files          31       31              
  Lines        3260     3266       +6     
==========================================
+ Hits         2946     2950       +4     
- Misses        256      257       +1     
- Partials       58       59       +1     

β˜” View full report in Codecov by Sentry.
πŸ“’ Have feedback on the report? Share it here.

@dundee dundee merged commit a25ff5d into dundee:master Feb 12, 2024
10 checks passed
@dundee
Copy link
Owner

dundee commented Feb 12, 2024

Thank you for your contribution!

And sorry for late reply πŸ€¦β€β™‚οΈ

@ShivamB25
Copy link
Contributor Author

Thank you for your contribution!

And sorry for late reply πŸ€¦β€β™‚οΈ

no problemo i was mostly using it for myself as i often pressed accidentally {d} on emtpy folders.

@ShivamB25 ShivamB25 changed the title fixes: Panic with Interface Conversion Nil Error πŸ”§βœ¨ Handle nil case for selectedDir and selectedDirCell (Interface Conversion Nil Error) Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants