Merge "ResourcesManager: Throw exception if failed to load asset path" into nyc-dev am: 1362ae0
am: 40c6118
* commit '40c611853eedd9d7ebf41a778e278751fbc82cb8':
ResourcesManager: Throw exception if failed to load asset path
Change-Id: I609d2b2a22ecb274c21a413edabd7ac4b28fbc94
This commit is contained in:
@@ -224,7 +224,7 @@ public class ResourcesManager {
|
||||
* @return a new AssetManager.
|
||||
*/
|
||||
@VisibleForTesting
|
||||
protected AssetManager createAssetManager(@NonNull final ResourcesKey key) {
|
||||
protected @NonNull AssetManager createAssetManager(@NonNull final ResourcesKey key) {
|
||||
AssetManager assets = new AssetManager();
|
||||
|
||||
// resDir can be null if the 'android' package is creating a new Resources object.
|
||||
@@ -232,14 +232,15 @@ public class ResourcesManager {
|
||||
// already.
|
||||
if (key.mResDir != null) {
|
||||
if (assets.addAssetPath(key.mResDir) == 0) {
|
||||
return null;
|
||||
throw new IllegalArgumentException("failed to add asset path " + key.mResDir);
|
||||
}
|
||||
}
|
||||
|
||||
if (key.mSplitResDirs != null) {
|
||||
for (final String splitResDir : key.mSplitResDirs) {
|
||||
if (assets.addAssetPath(splitResDir) == 0) {
|
||||
return null;
|
||||
throw new IllegalArgumentException(
|
||||
"failed to add split asset path " + splitResDir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user