Skip to content

Commit

Permalink
Avoid unnecessary null pointer exception if reference schema is given
Browse files Browse the repository at this point in the history
  • Loading branch information
laurisvan committed May 10, 2024
1 parent 2fb11c6 commit 2709a70
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/src/json_schema/json_schema.dart
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,10 @@ class JsonSchema {
_customFormats = customFormats;
_rootMemomizedPathResults = {};
try {
_fetchedFromUriBase = JsonSchemaUtils.getBaseFromFullUri(_fetchedFromUri!);
// Only fetch the base if given
if (_fetchedFromUri != null) {
_fetchedFromUriBase = JsonSchemaUtils.getBaseFromFullUri(_fetchedFromUri!);
}
} catch (e) {
// ID base can't be set for schemes other than HTTP(S).
// This is expected behavior.
Expand Down

0 comments on commit 2709a70

Please sign in to comment.