We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e11dc0d commit be06e32Copy full SHA for be06e32
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