Fix NPE in slice data generation
NPE will be occurred when clients gives invalid slice uri for Settings. We have defined some rules in getPathData() and it will return null object when the invalid uri was given. NPE will be happened in next. Change-Id: I6ebadd4383aee6e69b1c2eb6c84071c961fd72a7 Fixes: 120259627 Test: robotests
This commit is contained in:
@@ -71,6 +71,9 @@ public class SlicesDatabaseAccessor {
|
|||||||
*/
|
*/
|
||||||
public SliceData getSliceDataFromUri(Uri uri) {
|
public SliceData getSliceDataFromUri(Uri uri) {
|
||||||
Pair<Boolean, String> pathData = SliceBuilderUtils.getPathData(uri);
|
Pair<Boolean, String> pathData = SliceBuilderUtils.getPathData(uri);
|
||||||
|
if (pathData == null) {
|
||||||
|
throw new IllegalStateException("Invalid Slices uri: " + uri);
|
||||||
|
}
|
||||||
Cursor cursor = getIndexedSliceData(pathData.second /* key */);
|
Cursor cursor = getIndexedSliceData(pathData.second /* key */);
|
||||||
return buildSliceData(cursor, uri, pathData.first /* isIntentOnly */);
|
return buildSliceData(cursor, uri, pathData.first /* isIntentOnly */);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user