Skip to content

Commit a797a79

Browse files
pditommasoclaude
andcommitted
Fix NPE in GoogleBatchMachineTypeSelector when spotPrice is null [ci fast]
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 9b1d1b6 commit a797a79

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

plugins/nf-google/src/main/nextflow/cloud/google/batch/GoogleBatchMachineTypeSelector.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ class GoogleBatchMachineTypeSelector {
153153
final json = "${CLOUD_INFO_API}/providers/google/services/compute/regions/${region}/products".toURL().text
154154
final data = new JsonSlurper().parseText(json)
155155
final products = data['products'] as List<Map>
156-
final averageSpotPrice = (List<Map> prices) -> prices.collect{it.price as float}.average() as float
156+
final averageSpotPrice = (List<Map> prices) -> prices ? prices.collect{it.price as float}.average() as float : 0.0f
157157

158158
products.collect {
159159
new MachineType(

0 commit comments

Comments
 (0)