We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents b967464 + be06e32 commit 8872465Copy full SHA for 8872465
core/java/android/widget/Switch.java
@@ -750,10 +750,11 @@ protected void onDraw(Canvas canvas) {
750
mTextPaint.drawableState = getDrawableState();
751
752
Layout switchText = getTargetCheckedState() ? mOnLayout : mOffLayout;
753
-
754
- canvas.translate((thumbLeft + thumbRight) / 2 - switchText.getWidth() / 2,
755
- (switchInnerTop + switchInnerBottom) / 2 - switchText.getHeight() / 2);
756
- switchText.draw(canvas);
+ if (switchText != null) {
+ canvas.translate((thumbLeft + thumbRight) / 2 - switchText.getWidth() / 2,
+ (switchInnerTop + switchInnerBottom) / 2 - switchText.getHeight() / 2);
+ switchText.draw(canvas);
757
+ }
758
759
canvas.restore();
760
}
0 commit comments