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

Avoid attempting to refer to an unknown index in views alter hook #876

Merged
merged 1 commit into from
Jun 7, 2022

Conversation

adam-vessey
Copy link

When running in a bare site (without any content... like, in a unit
testing rig), this ends up trying to refer to a non-existent offset.

... add an isset() test to avoid doing so.

GitHub Issue: This one.

  • Other Relevant Links (Google Groups discussion, related pull requests,
    Release pull requests, etc.)

N/A

What does this Pull Request do?

Tests of the existence of views data being copied before attempting to reference it, as it may not exist.

What's new?

Just added an isset() check before blindly attempting to use views data.

  • Does this change add any new dependencies? No.
  • Does this change require any other modifications to be made to the repository
    (i.e. Regeneration activity, etc.)? No.
  • Could this change impact execution of existing code? Shouldn't.

How should this be tested?

Good question... kind of surprised this doesn't pop up in this module's tests...

Documentation Status

  • Does this change existing behaviour that's currently documented? Shouldn't.
  • Does this change require new pages or sections of documentation? No.
  • Who does this need to be documented for? Unknown
  • Associated documentation pull request(s): ___ or documentation issue ___

Additional Notes:

Any additional information that you think would be helpful when reviewing this
PR.

Interested parties

Tag (@ mention) interested parties or, if unsure, @Islandora/8-x-committers

When running in a bare site (without any content... like, in a unit
testing rig), this ends up trying to refer to a non-existent offset.

... add an `isset()` test to avoid doing so.
Copy link
Member

@whikloj whikloj left a comment

Choose a reason for hiding this comment

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

I can't see how this causes any problems, I'll try to test it this week.

@whikloj whikloj merged commit 3d122af into Islandora:2.x Jun 7, 2022
@adam-vessey adam-vessey deleted the fix/avoid-unknown-index branch July 18, 2022 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