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

Prevent unhandled exception when FieldsPopupElement.Fields list is empty #520

Merged
merged 1 commit into from
Aug 11, 2023
Merged

Prevent unhandled exception when FieldsPopupElement.Fields list is empty #520

merged 1 commit into from
Aug 11, 2023

Conversation

AndrewBladon
Copy link
Contributor

@AndrewBladon AndrewBladon commented Aug 3, 2023

Issue: none

Description:
When using a popup view with a feature layer that does not have any attributes (e.g. point has no default attributes), a System.ArgumentException can occur in the FieldPopupElementView.RefreshTable() method (see image below for exception details). This PR introduces a check to see if the FieldsPopupElement.Fields list is empty and, if the list is empty, results in the content being set to null and the method returning. This prevents the exception occuring.

image

Summary of issue:
In the FieldPopupElementView.RefreshTable() method:

  • A local variable i is initialised with a value of 0 (link to code).
  • i is increased in a loop that progresses up to the number of Labels or FormattedValues.
  • If there are no Fields, I believe there can be no Labels or FormattedValues, so the value of i stays as 0.
  • The subsequent call to Grid.SetRowSpan(verticalDivider, i); (link to code) causes the exception because i is 0.

@williambohrmann3
Copy link
Collaborator

cc @dotMorten

@dotMorten dotMorten merged commit 8776f55 into Esri:main Aug 11, 2023
1 check passed
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.

3 participants