Skip to content

Commit 8e550b4

Browse files
committed
Guard against requesting an empty path
This which would denote the root of the repository which shouldn't be loaded as an image source bitmap
1 parent f8afd97 commit 8e550b4

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

app/src/main/java/com/github/mobile/util/HttpImageGetter.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,14 @@ private Drawable requestRepositoryImage(final String source)
234234
return null;
235235

236236
StringBuilder path = new StringBuilder(segments.get(4));
237-
for (int i = 5; i < segments.size(); i++)
238-
path.append('/').append(segments.get(i));
237+
for (int i = 5; i < segments.size(); i++) {
238+
String segment = segments.get(i);
239+
if (!TextUtils.isEmpty(segment))
240+
path.append('/').append(segment);
241+
}
242+
243+
if (TextUtils.isEmpty(path))
244+
return null;
239245

240246
List<RepositoryContents> contents = service.getContents(
241247
RepositoryId.create(owner, name), path.toString(), branch);

0 commit comments

Comments
 (0)