aware of not sourcemap file

This commit is contained in:
Vladimir Krivosheev
2014-05-13 14:36:16 +02:00
parent adfec67fc4
commit 0f964dada0
@@ -67,10 +67,10 @@ public final class SourceMapDecoder {
@Nullable
private static SourceMap parseMap(JsonReaderEx reader,
int line,
int column,
List<MappingEntry> mappings,
@NotNull Function<List<String>, SourceResolver> sourceResolverFactory) throws IOException {
int line,
int column,
List<MappingEntry> mappings,
@NotNull Function<List<String>, SourceResolver> sourceResolverFactory) throws IOException {
reader.beginObject();
String sourceRoot = null;
JsonReaderEx sourcesReader = null;
@@ -120,6 +120,12 @@ public final class SourceMapDecoder {
}
reader.close();
// check it before other checks, probably it is not sourcemap file
if (StringUtil.isEmpty(encodedMappings)) {
// empty map
return null;
}
if (version != 3) {
throw new IOException("Unsupported sourcemap version: " + version);
}
@@ -128,11 +134,6 @@ public final class SourceMapDecoder {
throw new IOException("sources is not specified");
}
if (StringUtil.isEmpty(encodedMappings)) {
// empty map
return null;
}
List<String> sources = readSources(sourcesReader, sourceRoot);
@SuppressWarnings("unchecked")