android: Fix updating password for managed profiles

Without data source set on the profile, this caused the app to crash
with a null pointer dereference when it is updated.
This commit is contained in:
Tobias Brunner
2025-02-18 14:12:43 +01:00
parent 19925fd893
commit e6b040265d
@@ -98,7 +98,14 @@ public class VpnProfileManagedDataSource implements VpnProfileDataSource
@Override
public VpnProfile getVpnProfile(UUID uuid)
{
return mManagedConfigurationService.getManagedProfiles().get(uuid.toString());
final VpnProfile vpnProfile = mManagedConfigurationService.getManagedProfiles().get(uuid.toString());
if (vpnProfile != null)
{
final String password = mSharedPreferences.getString(uuid.toString(), vpnProfile.getPassword());
vpnProfile.setPassword(password);
vpnProfile.setDataSource(this);
}
return vpnProfile;
}
@Override