Skip to content

Commit

Permalink
Fixes accessing to method on invalid object (#379)
Browse files Browse the repository at this point in the history
  • Loading branch information
alecharp authored Oct 10, 2023
1 parent 241a23f commit 2283ba6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ public class CodeCoverageProbe extends Probe {
protected ProbeResult doApply(Plugin plugin, ProbeContext context) {
final io.jenkins.pluginhealth.scoring.model.updatecenter.Plugin ucPlugin =
context.getUpdateCenter().plugins().get(plugin.getName());
if (ucPlugin == null) {
return error("Plugin cannot be found in Update-Center.");
}
final String defaultBranch = ucPlugin.defaultBranch();
if (defaultBranch == null || defaultBranch.isBlank()) {
return this.error("No default branch configured for the plugin.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ public class SpotBugsProbe extends Probe {
protected ProbeResult doApply(Plugin plugin, ProbeContext context) {
final io.jenkins.pluginhealth.scoring.model.updatecenter.Plugin ucPlugin =
context.getUpdateCenter().plugins().get(plugin.getName());
if (ucPlugin == null) {
return error("Plugin cannot be found in Update-Center.");
}
final String defaultBranch = ucPlugin.defaultBranch();
if (defaultBranch == null || defaultBranch.isBlank()) {
return this.error("No default branch configured for the plugin.");
Expand Down

0 comments on commit 2283ba6

Please sign in to comment.