1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-09 18:56:02 +02:00

Fix possible /0 error

This commit is contained in:
Anton Leherbauer 2006-12-04 07:53:38 +00:00
parent 57c1b16f8f
commit 2ad07322d6

View file

@ -1199,7 +1199,7 @@ public class LocationMap implements ILocationResolver, IScannerPreprocessorLog {
// TODO consider '\r' line endings?
if (buffer[i] == '\n') {
if (lineOffsets.length == lines) {
final int ratio= Math.min(i / lines, 20);
final int ratio= Math.min(Math.max(i / lines, 1), 20);
int[] tmp= new int[lines + (buffer.length - i) / ratio + 1];
System.arraycopy(lineOffsets, 0, tmp, 0, lines);
lineOffsets= tmp;