diff options
author | Marin Shalamanov <shalamanov@google.com> | 2020-04-23 13:59:35 +0200 |
---|---|---|
committer | Marin Shalamanov <shalamanov@google.com> | 2020-04-23 14:07:56 +0200 |
commit | 059789867e8b1e9e60354d723d1ade217291c3de (patch) | |
tree | f8c98d418a5575d1908d55cb73fe81a02fecc5fb | |
parent | b22f2113544f2bcb6929857df0de8b17c41dfb8b (diff) | |
download | tvsystem-059789867e8b1e9e60354d723d1ade217291c3de.tar.gz |
Add null check for DeviceProductInfo
This fixes a NPE when DeviceProductInfo is not
available, e.g. when HWC doesn't provide display
identification data (EDID).
Bug: 154745619
Test: manually test that NPE doesn't reproduce
Change-Id: I80441541a2aec474c27d0d8b51cb46204e0a14c3
-rw-r--r-- | java/com/android/libraries/tv/tvsystem/display/DisplayCompatUtil.java | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/java/com/android/libraries/tv/tvsystem/display/DisplayCompatUtil.java b/java/com/android/libraries/tv/tvsystem/display/DisplayCompatUtil.java index 4b8da67..f2badb4 100644 --- a/java/com/android/libraries/tv/tvsystem/display/DisplayCompatUtil.java +++ b/java/com/android/libraries/tv/tvsystem/display/DisplayCompatUtil.java @@ -52,6 +52,9 @@ public final class DisplayCompatUtil { DisplayInfo displayInfo = new DisplayInfo(); display.getDisplayInfo(displayInfo); android.hardware.display.DeviceProductInfo info = displayInfo.deviceProductInfo; + if (info == null) { + return null; + } DeviceProductInfo.ManufactureDate manufactureDate; if (info.getManufactureDate() == null) { manufactureDate = null; |