Skip to content

Commit

Permalink
Prevent object validation on null
Browse files Browse the repository at this point in the history
  • Loading branch information
GDownes committed Nov 10, 2023
1 parent 02f8406 commit bd0477b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ class ArrayValidator {
class ObjectValidator {

static objectValidation(value: any, location: string, schema: SchemaInfo): Invalid[] {
const valid = typeof value === 'object' && !Array.isArray(value);
const valid = value !== null && typeof value === 'object' && !Array.isArray(value);
return validate(value, location, schema, () => `Expected value to be an object`, valid)
}

Expand Down

0 comments on commit bd0477b

Please sign in to comment.