From 2ad07322d68cdd1c4ea96ca2de61b7573c786611 Mon Sep 17 00:00:00 2001 From: Anton Leherbauer Date: Mon, 4 Dec 2006 07:53:38 +0000 Subject: [PATCH] Fix possible /0 error --- .../eclipse/cdt/internal/core/parser/scanner2/LocationMap.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/LocationMap.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/LocationMap.java index e7affdff381..e2c8cb46240 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/LocationMap.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/LocationMap.java @@ -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;