mirror of
https://github.com/dlang-community/D-Scanner.git
synced 2025-04-29 06:40:01 +03:00
fix infinite allocating in context formatter
This commit is contained in:
parent
48db254fb0
commit
e411f01c3f
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;
|
import std.string : indexOf, lastIndexOf;
|
||||||
|
|
||||||
if (diagnostic.startIndex >= diagnostic.endIndex || diagnostic.endIndex > code.length
|
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;
|
return null;
|
||||||
|
|
||||||
auto lineStart = code.lastIndexOf('\n', diagnostic.startIndex) + 1;
|
auto lineStart = code.lastIndexOf('\n', diagnostic.startIndex) + 1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue