am bb4075bc: Merge "Fix possible NPE in MainKeyboardView"

* commit 'bb4075bc9378b791f5b73bde2a448acc50606947':
  Fix possible NPE in MainKeyboardView
main
Tadashi G. Takaoka 2014-11-27 03:05:30 +00:00 committed by Android Git Automerger
commit 2daf1b910a
1 changed files with 5 additions and 2 deletions

View File

@ -869,13 +869,16 @@ public final class MainKeyboardView extends KeyboardView implements DrawingProxy
}
private void drawLanguageOnSpacebar(final Key key, final Canvas canvas, final Paint paint) {
final Keyboard keyboard = getKeyboard();
if (keyboard == null) {
return;
}
final int width = key.getWidth();
final int height = key.getHeight();
paint.setTextAlign(Align.CENTER);
paint.setTypeface(Typeface.DEFAULT);
paint.setTextSize(mLanguageOnSpacebarTextSize);
final RichInputMethodSubtype subtype = getKeyboard().mId.mSubtype;
final String language = layoutLanguageOnSpacebar(paint, subtype, width);
final String language = layoutLanguageOnSpacebar(paint, keyboard.mId.mSubtype, width);
// Draw language text with shadow
final float descent = paint.descent();
final float textHeight = -paint.ascent() + descent;