Skip to content

Commit

Permalink
Merge pull request #188 from laurisvan/chore/avoid-unnecessary-npe-on…
Browse files Browse the repository at this point in the history
…-initialize

Avoid unnecessary null pointer exception if reference schema is given
  • Loading branch information
rmconsole5-wk authored Jul 24, 2024
2 parents 62e33ac + 2709a70 commit 74652d4
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 74652d4

Please sign in to comment.