Skip to content

Conversation

@seer-by-sentry
Copy link
Contributor

Resolved / Related Issues

To prevent extra work, all changes to the Files codebase must link to an approved issue marked as Ready to build. Please insert the issue number following the hashtag with the issue number that this Pull Request resolves.

Steps used to test these changes

Stability is a top priority for Files and all changes are required to go through testing before being merged into the repo. Please include a list of steps that you used to test this PR.

  1. Opened Files ...
  2. Navigated between tabs...
  3. Verified that no NullReferenceException occurs when accessing TabBarItemParameter.

@yaira2 yaira2 requested a review from Copilot September 12, 2025 14:27
@yaira2 yaira2 marked this pull request as ready for review September 12, 2025 14:27
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a NullReferenceException that occurs when accessing TabBarItemParameter by properly retrieving the NavigationParameter from the corresponding TabBarItem instead of directly accessing it from the CurrentInstance.

  • Adds a lookup to find the corresponding TabBarItem that contains the current instance
  • Updates the navigation parameter retrieval to use the found TabBarItem
  • Includes a descriptive comment explaining the purpose of the new lookup logic

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +143 to +144
var correspondingTabItem = ViewModel.AppInstances.FirstOrDefault(tabItem => tabItem.TabItemContent == e.CurrentInstance);
var navArgs = correspondingTabItem?.NavigationParameter?.NavigationParameter;
Copy link

Copilot AI Sep 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The FirstOrDefault lookup is performed every time the current instance changes. Consider caching this relationship or using a more efficient lookup mechanism if this event fires frequently during tab navigation.

Copilot uses AI. Check for mistakes.
@yaira2 yaira2 closed this Sep 12, 2025
@yaira2 yaira2 deleted the seer/fix/correct-navigation-parameter branch September 12, 2025 14:36
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