If we fail to get the deminified stackframe method, we shouldn't attempt to get the source position or file path

This commit is contained in:
thomabr 2016-11-17 11:49:13 -08:00
Родитель 0bd150bfe8
Коммит 5d7af30c6a
1 изменённых файлов: 22 добавлений и 19 удалений

Просмотреть файл

@ -33,27 +33,30 @@ namespace SourcemapToolkit.CallstackDeminifier
SourcePosition generatedSourcePosition = stackFrame.SourcePosition; SourcePosition generatedSourcePosition = stackFrame.SourcePosition;
StackFrameDeminificationResult result = base.DeminifyStackFrame(stackFrame); StackFrameDeminificationResult result = base.DeminifyStackFrame(stackFrame);
if (result.DeminificationError == DeminificationError.None)
MappingEntry generatedSourcePositionMappingEntry = sourceMap?.GetMappingEntryForGeneratedSourcePosition(generatedSourcePosition);
if (generatedSourcePositionMappingEntry == null)
{ {
if (sourceMap == null) MappingEntry generatedSourcePositionMappingEntry =
{ sourceMap?.GetMappingEntryForGeneratedSourcePosition(generatedSourcePosition);
result.DeminificationError = DeminificationError.NoSourceMap;
}
else if (sourceMap.ParsedMappings == null)
{
result.DeminificationError = DeminificationError.SourceMapFailedToParse;
}
else
{
result.DeminificationError = DeminificationError.NoMatchingMapingInSourceMap;
}
}
result.DeminifiedStackFrame.FilePath = generatedSourcePositionMappingEntry?.OriginalFileName; if (generatedSourcePositionMappingEntry == null)
result.DeminifiedStackFrame.SourcePosition = generatedSourcePositionMappingEntry?.OriginalSourcePosition; {
if (sourceMap == null)
{
result.DeminificationError = DeminificationError.NoSourceMap;
}
else if (sourceMap.ParsedMappings == null)
{
result.DeminificationError = DeminificationError.SourceMapFailedToParse;
}
else
{
result.DeminificationError = DeminificationError.NoMatchingMapingInSourceMap;
}
}
result.DeminifiedStackFrame.FilePath = generatedSourcePositionMappingEntry?.OriginalFileName;
result.DeminifiedStackFrame.SourcePosition = generatedSourcePositionMappingEntry?.OriginalSourcePosition;
}
return result; return result;
} }