Skip to content

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

Merged
mrnugget merged 1 commit into
mainfrom
mrn/fix-uninitialized-map
Nov 17, 2020
Merged

Fix panic when search yields repo and file matches in same repo#385
mrnugget merged 1 commit into
mainfrom
mrn/fix-uninitialized-map

Conversation

@mrnugget

Copy link
Copy Markdown
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.

@eseliger eseliger left a comment

Copy link
Copy Markdown
Member

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

@chrispine chrispine left a comment

Copy link
Copy Markdown

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