Skip to content

Commit f512664

Browse files
author
Anthony Newnam
committed
Don't allow invalid Uris to be added as observers.
If a null segment is added, it will cause problems traversing the list at a later point. Change-Id: I5aa97b969cac7231e214168af7d3263b1c16f0a0
1 parent 1152df7 commit f512664

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

core/java/android/content/ContentService.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,9 @@ private void addObserver(Uri uri, int index, IContentObserver observer,
496496

497497
// Look to see if the proper child already exists
498498
String segment = getUriSegment(uri, index);
499+
if (segment == null) {
500+
throw new IllegalArgumentException("Invalid Uri (" + uri + ") used for observer");
501+
}
499502
int N = mChildren.size();
500503
for (int i = 0; i < N; i++) {
501504
ObserverNode node = mChildren.get(i);

0 commit comments

Comments
 (0)