Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 83a1f7fe authored by Svetoslav Ganov's avatar Svetoslav Ganov
Browse files

Add a missing null object check

We now have a null object instead of null values and
there was a place where we returned null instead of
the correct null object.

bug:28423485

Change-Id: I2626768acdf8d19fc94aa5e978eb057818450fa5
parent 8438a729
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -846,7 +846,7 @@ public class SettingsProvider extends ContentProvider {


                // Special case for location (sigh).
                // Special case for location (sigh).
                if (isLocationProvidersAllowedRestricted(name, callingUserId, owningUserId)) {
                if (isLocationProvidersAllowedRestricted(name, callingUserId, owningUserId)) {
                    return null;
                    continue;
                }
                }


                Setting setting = mSettingsRegistry.getSettingLocked(
                Setting setting = mSettingsRegistry.getSettingLocked(
@@ -871,7 +871,8 @@ public class SettingsProvider extends ContentProvider {


        // Special case for location (sigh).
        // Special case for location (sigh).
        if (isLocationProvidersAllowedRestricted(name, callingUserId, owningUserId)) {
        if (isLocationProvidersAllowedRestricted(name, callingUserId, owningUserId)) {
            return null;
            return mSettingsRegistry.getSettingsLocked(SETTINGS_TYPE_SECURE,
                    owningUserId).getNullSetting();
        }
        }


        // Get the value.
        // Get the value.
+4 −1
Original line number Original line Diff line number Diff line
@@ -16,7 +16,6 @@


package com.android.providers.settings;
package com.android.providers.settings;


import android.os.Bundle;
import android.os.Handler;
import android.os.Handler;
import android.os.Message;
import android.os.Message;
import android.os.SystemClock;
import android.os.SystemClock;
@@ -159,6 +158,10 @@ final class SettingsState {
        return mVersion;
        return mVersion;
    }
    }


    public Setting getNullSetting() {
        return mNullSetting;
    }

    // The settings provider must hold its lock when calling here.
    // The settings provider must hold its lock when calling here.
    public void setVersionLocked(int version) {
    public void setVersionLocked(int version) {
        if (version == mVersion) {
        if (version == mVersion) {