Do not crash in details view if we try to view local image

Makes sure that if we don't have an image set, we just do nothing
rather than crash badly

Change-Id: Id1947be4cda1dff1610c69213d7ada986c6a9c67
GitHub: https://github.com/wikimedia/apps-android-commons/pull/9
This commit is contained in:
YuviPanda 2013-06-14 14:34:56 +00:00 committed by SuchABot
parent 65a01c4459
commit 4de5c124e1

View file

@ -78,6 +78,10 @@ public class MediaWikiImageView extends ImageView {
return; return;
} }
if(mMedia == null) {
return;
}
final String mUrl; final String mUrl;
if(tryOriginal) { if(tryOriginal) {
mUrl = mMedia.getImageUrl(); mUrl = mMedia.getImageUrl();
@ -172,9 +176,7 @@ public class MediaWikiImageView extends ImageView {
@Override @Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) { protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom); super.onLayout(changed, left, top, right, bottom);
Log.d("Commons", "Called via onLayout");
loadImageIfNecessary(true); loadImageIfNecessary(true);
// Called via onLayout
} }
@Override @Override