Skip to content

Commit 2342f36

Browse files
jjpprrrrGenkzsz11
authored andcommitted
AndroidSClockController: fix NPE in setSlice
E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.widget.TextClock.getId()' on a null object reference E AndroidRuntime: at com.android.keyguard.clock.AndroidSClockController.setSlice(AndroidSClockController.java:379) Signed-off-by: Chenyang Zhong <zhongcy95@gmail.com> Change-Id: Ie23ab0008362a8b95f303fdfb17fcb9759c0ad05
1 parent 6c92b9c commit 2342f36

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

packages/SystemUI/src/com/android/keyguard/clock/AndroidSClockController.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,8 +377,12 @@ public void setSlice(Slice slice) {
377377
mTitle.requestLayout();
378378
mRow.requestLayout();
379379

380-
mRowHeight = mRow.getHeight() + (mHasHeader ? mTitle.getHeight() : 0);
381-
if (mRow.getChildCount() != 0) mContainerSetBig.setMargin(mClock.getId(), ConstraintSet.TOP, mRowHeight);
380+
if (mClock != null) {
381+
mRowHeight = mRow.getHeight() + (mHasHeader ? mTitle.getHeight() : 0);
382+
if (mRow.getChildCount() != 0) {
383+
mContainerSetBig.setMargin(mClock.getId(), ConstraintSet.TOP, mRowHeight);
384+
}
385+
}
382386
};
383387

384388
/**

0 commit comments

Comments
 (0)