Skip to content

Commit 066e189

Browse files
committed
Add error handling for invalid GPU ID in CellposeDetectorDescriptor
1 parent cb48503 commit 066e189

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/main/java/org/mastodon/tracking/mamut/trackmate/wizard/descriptors/cellpose/CellposeDetectorDescriptor.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,14 @@ protected void getSettingsAndUpdateConfigPanel()
165165
gpuIdValue = DEFAULT_GPU_ID; // default
166166
else
167167
gpuIdValue = Integer.parseInt( String.valueOf( gpuIdObject ) );
168-
this.gpuId.setSelectedIndex( gpuIdValue );
168+
try
169+
{
170+
this.gpuId.setSelectedIndex( gpuIdValue );
171+
}
172+
catch (IllegalArgumentException e)
173+
{
174+
logger.debug( "Could not set GPU ID to "+gpuIdValue+". Defaulting to no GPU. Error message: " + e.getMessage() );
175+
}
169176

170177
final Object gpuMemFractionObject =
171178
detectorSettings.get( KEY_GPU_MEMORY_FRACTION );

0 commit comments

Comments
 (0)