Skip to content

Commit c1e051b

Browse files
committed
fix infinite allocating in context formatter
1 parent 48db254 commit c1e051b

File tree

1 file changed

+2
-1
lines changed
  • src/dscanner/analysis

1 file changed

+2
-1
lines changed

src/dscanner/analysis/run.d

+2-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ private string formatContext(Message.Diagnostic diagnostic, scope const(char)[]
133133
import std.string : indexOf, lastIndexOf;
134134

135135
if (diagnostic.startIndex >= diagnostic.endIndex || diagnostic.endIndex > code.length
136-
|| diagnostic.startColumn >= diagnostic.endColumn || diagnostic.endColumn == 0)
136+
|| diagnostic.startColumn >= diagnostic.endColumn || diagnostic.endColumn == 0
137+
|| diagnostic.startColumn == 0)
137138
return null;
138139

139140
auto lineStart = code.lastIndexOf('\n', diagnostic.startIndex) + 1;

0 commit comments

Comments
 (0)