Skip to content

Commit

Permalink
fb: fix reconstruct statusbar illegal argument exception thanks a ton…
Browse files Browse the repository at this point in the history
… kufikugel!

Change-Id: Ia1044657934654861ae02222f255be3d8fb0d960
  • Loading branch information
codex-corp committed Jan 15, 2014
1 parent a97d4b5 commit c2e1bab
Showing 1 changed file with 11 additions and 2 deletions.
Expand Up @@ -78,8 +78,11 @@ public final class Segment {
public StaticLayout getLayout(CharSequence substr) {
int w = mTextSwitcher.getWidth() - mTextSwitcher.getPaddingLeft()
- mTextSwitcher.getPaddingRight();
if (w < 0) w = 0;
return new StaticLayout(substr, mPaint, w, Alignment.ALIGN_NORMAL, 1, 0, true);
if (w < 0) {
return null;
} else {
return new StaticLayout(substr, mPaint, w, Alignment.ALIGN_NORMAL, 1, 0, true);
}
}

public CharSequence rtrim(CharSequence substr, int start, int end) {
Expand All @@ -99,6 +102,9 @@ public CharSequence getText() {
}
CharSequence substr = this.text.subSequence(this.current, this.text.length());
StaticLayout l = getLayout(substr);
if (l == null) {
return null;
}
int lineCount = l.getLineCount();
if (lineCount > 0) {
int start = l.getLineStart(0);
Expand All @@ -125,6 +131,9 @@ public CharSequence advance() {

CharSequence substr = this.text.subSequence(index, this.text.length());
StaticLayout l = getLayout(substr);
if (l == null) {
return null;
}
final int lineCount = l.getLineCount();
int i;
for (i=0; i<lineCount; i++) {
Expand Down

0 comments on commit c2e1bab

Please sign in to comment.