mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 880171 - Part 1: return null if unable to retrieve storage in EnvironmentBuilder. r=nalexander
This commit is contained in:
parent
7f89dd1fc5
commit
d709778bb9
@ -27,9 +27,22 @@ public class EnvironmentBuilder {
|
||||
return cr.acquireContentProviderClient(HealthReportConstants.HEALTH_AUTHORITY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch the storage object associated with the provided
|
||||
* {@link ContentProviderClient}. If no storage instance can be found --
|
||||
* perhaps because the {@link ContentProvider} is running in a different
|
||||
* process -- returns <code>null</code>.
|
||||
*
|
||||
* If the provider is not a {@link HealthReportProvider}, throws a
|
||||
* {@link ClassCastException}, because that would be disastrous.
|
||||
*/
|
||||
public static HealthReportDatabaseStorage getStorage(ContentProviderClient cpc,
|
||||
String profilePath) {
|
||||
ContentProvider pr = cpc.getLocalContentProvider();
|
||||
if (pr == null) {
|
||||
Logger.error(LOG_TAG, "Unable to retrieve local content provider. Running in a different process?");
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return ((HealthReportProvider) pr).getProfileStorage(profilePath);
|
||||
} catch (ClassCastException ex) {
|
||||
|
Loading…
Reference in New Issue
Block a user