Permalink
Browse files

TISTUD-1352 - Avoid a divide by zero error

  • Loading branch information...
1 parent 87d33db commit 6c137a80b48a4342e199c28dde19d8a568d060dd Shalom Gibly committed Mar 15, 2012
@@ -438,8 +438,7 @@ public boolean overwriteBracket(char bracket, IDocument document, DocumentComman
* @throws BadLocationException
*/
protected Lexeme<PHPTokenType> getLastLexemeInLine(IDocument document,
- ILexemeProvider<PHPTokenType> lexemeProvider,
- int offset) throws BadLocationException
+ ILexemeProvider<PHPTokenType> lexemeProvider, int offset) throws BadLocationException
{
IRegion lineRegion = document.getLineInformationOfOffset(offset);
int lastCharInLine = lineRegion.getOffset() + lineRegion.getLength();
@@ -680,7 +679,7 @@ protected String getIndentationString(IDocument d, int lineOffset, int firstNonW
}
int indentSize = 0;
- int tabWidth = this.configuration.getTabWidth(sourceViewer);
+ int tabWidth = Math.max(1, this.configuration.getTabWidth(sourceViewer));
char[] indentChars = lineIndent.toCharArray();
for (int i = 0; i < indentChars.length; i++)
{

0 comments on commit 6c137a8

Please sign in to comment.