Skip to content

Commit 5da9569

Browse files
committed
Update IsSupported to check feature readiness state
Improved IsSupported logic in ObjectEraseHelper to return true only when the object erase model is ready or can be downloaded, ensuring unsupported states are handled correctly.
1 parent 37c1e67 commit 5da9569

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

MagickCrop/Helpers/ObjectEraseHelper.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ internal static bool IsSupported()
2020
{
2121
try
2222
{
23-
_ = ImageObjectRemover.GetReadyState();
24-
return true;
23+
AIFeatureReadyState state = ImageObjectRemover.GetReadyState();
24+
// Only consider it supported if the model is ready or can be downloaded.
25+
// Other states (e.g. EvaluationNotReady, DisabledByUser) mean it's not usable.
26+
return state is AIFeatureReadyState.Ready or AIFeatureReadyState.NotReady;
2527
}
2628
catch
2729
{

0 commit comments

Comments
 (0)