From cfc601c16a7cf04251b272654f46c7eeb75539b8 Mon Sep 17 00:00:00 2001 From: Rodin Aarssen Date: Wed, 18 Dec 2024 11:08:30 +0100 Subject: [PATCH] Fixed logic around fallback resolver in URIResolverRegistry (#2101) * Fixed logic around the fallback resolver returning null while resolving locations * Accounted for another edge case around the fallback resolver. Thanks @DavyLandman * Improved handling of an edge case around the fallback resolver. * Improved handling of an edge case around the fallback resolver. --- src/org/rascalmpl/uri/URIResolverRegistry.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/org/rascalmpl/uri/URIResolverRegistry.java b/src/org/rascalmpl/uri/URIResolverRegistry.java index 258fc34dd9c..9051eb8c764 100644 --- a/src/org/rascalmpl/uri/URIResolverRegistry.java +++ b/src/org/rascalmpl/uri/URIResolverRegistry.java @@ -402,9 +402,10 @@ private ISourceLocation physicalLocation(ISourceLocation loc) throws IOException ILogicalSourceLocationResolver resolver = map.get(auth); loc = resolveAndFixOffsets(loc, resolver, map.values()); } - var fallBack = fallbackLogicalResolver; - if (fallBack != null) { - return resolveAndFixOffsets(loc == null ? original : loc, fallBack, Collections.emptyList()); + + if (fallbackLogicalResolver != null) { + var fallbackResult = resolveAndFixOffsets(loc == null ? original : loc, fallbackLogicalResolver, Collections.emptyList()); + return fallbackResult == null ? loc : fallbackResult; } return loc; }