Skip to content

Fix panic when search yields repo and file matches in same repo #385

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

Merged
merged 1 commit into from
Nov 17, 2020

Conversation

mrnugget
Copy link
Contributor

This fixes #382 by fixing a regression that was introduced by #361.

When the search queries defined in a campaign spec yielded a repository
match result and file match results in the same repository, in that
order, the code would crash because of an uninitialized map.

The code here fixes it by always initializing the map.

I also added a test that reproduces the behaviour and documents how we
turn multiple search results into a list of repositories.

This fixes #382 by fixing a regression that was introduced by #361.

When the search queries defined in a campaign spec yielded a repository
match result and file match results in the same repository, in that
order, the code would crash because of an uninitialized map.

The code here fixes it by always initializing the map.

I also added a test that reproduces the behaviour and documents how we
turn multiple search results into a list of repositories.
Copy link
Member

@eseliger eseliger left a comment

Choose a reason for hiding this comment

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

Good catch

@mrnugget mrnugget merged commit 364a0e1 into main Nov 17, 2020
@mrnugget mrnugget deleted the mrn/fix-uninitialized-map branch November 17, 2020 12:13
Copy link
Contributor

@chrispine chrispine left a comment

Choose a reason for hiding this comment

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

👍

scjohns pushed a commit that referenced this pull request Apr 24, 2023
This fixes #382 by fixing a regression that was introduced by #361.

When the search queries defined in a campaign spec yielded a repository
match result and file match results in the same repository, in that
order, the code would crash because of an uninitialized map.

The code here fixes it by always initializing the map.

I also added a test that reproduces the behaviour and documents how we
turn multiple search results into a list of repositories.
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.

campaigns preview panics while resolving repositories
3 participants