DisplayModeControl: Add null check to setMode()

* getCurrentMode() can return null. Don't let setMode() try set a
  null mode because bad things happen.
* Let's make cmhw safe again (groan, I know that one was bad)

Change-Id: I20bdee4a0e8cbb0598f35770d71902332db51ddb
tirimbino
Kevin F. Haggerty 8 years ago
parent ffcfb9f6ac
commit 43a5d87023
  1. 4
      cmhw/org/cyanogenmod/hardware/DisplayModeControl.java

@ -113,6 +113,10 @@ public class DisplayModeControl {
* if this mode is valid.
*/
public static boolean setMode(DisplayMode mode, boolean makeDefault) {
if (mode == null) {
return false;
}
boolean success = FileUtils.writeLine(MODE_PATH, String.valueOf(mode.id));
if (success && makeDefault) {
return FileUtils.writeLine(DEFAULT_PATH, String.valueOf(mode.id));

Loading…
Cancel
Save