LineageSettingsService: prevent setting net.hostname to null

If the user did not set a custom hostname, the settings service will
set net.hostname to null.

Only set net.hostname if the user actually set a custom hostname.

Change-Id: Ie9cc84e5e8c9468a7e698896e2b21c14a37ebffc
Signed-off-by: Alexander Martinz <amartinz@shiftphones.com>
This commit is contained in:
Alexander Martinz
2020-06-25 16:00:28 +02:00
parent 343d1e5f1d
commit 4fed3ece43

View File

@@ -45,7 +45,9 @@ public class LineageSettingsService extends LineageSystemService {
// Load custom hostname
String hostname = LineageSettings.Secure.getString(mContext.getContentResolver(),
LineageSettings.Secure.DEVICE_HOSTNAME);
SystemProperties.set("net.hostname", hostname);
if (hostname != null) {
SystemProperties.set("net.hostname", hostname);
}
}
}