mirror of
https://github.com/dlang-community/D-Scanner.git
synced 2025-04-25 21:00:17 +03:00
fix infinite allocating in context formatter
This commit is contained in:
parent
48db254fb0
commit
c1e051bfba
1 changed files with 2 additions and 1 deletions
|
@ -133,7 +133,8 @@ private string formatContext(Message.Diagnostic diagnostic, scope const(char)[]
|
|||
import std.string : indexOf, lastIndexOf;
|
||||
|
||||
if (diagnostic.startIndex >= diagnostic.endIndex || diagnostic.endIndex > code.length
|
||||
|| diagnostic.startColumn >= diagnostic.endColumn || diagnostic.endColumn == 0)
|
||||
|| diagnostic.startColumn >= diagnostic.endColumn || diagnostic.endColumn == 0
|
||||
|| diagnostic.startColumn == 0)
|
||||
return null;
|
||||
|
||||
auto lineStart = code.lastIndexOf('\n', diagnostic.startIndex) + 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue