Skip to content

Commit e4b06cd

Browse files
Fix underflow
1 parent 4f13f0d commit e4b06cd

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

ReQuesty.Builder/Extensions/OpenApiSchemaExtensions.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,10 +323,12 @@ public static bool IsArrayOfTypes(this IOpenApiSchema? schema)
323323

324324
return schema.Type.HasValue && !IsPowerOfTwo((uint)(schema.Type.Value & ~JsonSchemaType.Null));
325325
}
326+
326327
private static bool IsPowerOfTwo(uint x)
327328
{
328-
return (x & (x - 1)) == 0;
329+
return x != 0 && (x & (x - 1)) == 0;
329330
}
331+
330332
private static readonly HashSet<JsonSchemaType> oDataTypes = [
331333
JsonSchemaType.Number,
332334
JsonSchemaType.Integer,

0 commit comments

Comments
 (0)