Browse files

Fix loading empty content

Addressed #3.
  • Loading branch information...
1 parent 0c2ec13 commit faeb254391174bbae9f5c0ca7a4b1e44ea3c68f0 @jjgod committed Feb 21, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 TTTextView.mm
View
4 TTTextView.mm
@@ -51,7 +51,7 @@ - (void) invalidateLayout
{
NSAttributedString *text = [document fileContents];
- if (! text)
+ if (!text || ![text length])
return;
NSSize contentSize = [[self enclosingScrollView] contentSize];
@@ -232,7 +232,7 @@ - (void) drawRect: (NSRect) rect
CTLineDraw(lineData.line, context);
}
- long percentage = roundtol(i * 100 / total);
+ long percentage = total ? roundtol(i * 100 / total) : 0;
if (percentage) {
statusField.integerValue = percentage;
statusField.stringValue = [NSString stringWithFormat: @"%ld%%", percentage];

0 comments on commit faeb254

Please sign in to comment.