[Android] Sidebar: fix a crash

Jean-Baptiste Kempf git at videolan.org
Fri Apr 12 19:12:17 CEST 2013


vlc-ports/android | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Fri Apr 12 19:11:48 2013 +0200| [a2ae1bb4683a4a7026f76fdbbb20340b2c193719] | committer: Jean-Baptiste Kempf

Sidebar: fix a crash

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=a2ae1bb4683a4a7026f76fdbbb20340b2c193719
---

 vlc-android/src/org/videolan/vlc/gui/SidebarAdapter.java |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/SidebarAdapter.java b/vlc-android/src/org/videolan/vlc/gui/SidebarAdapter.java
index 05ed1f9..f2a2231 100644
--- a/vlc-android/src/org/videolan/vlc/gui/SidebarAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/SidebarAdapter.java
@@ -113,9 +113,11 @@ public class SidebarAdapter extends BaseAdapter {
         TextView textView = (TextView)v;
         textView.setText(sidebarEntry.name);
         Drawable img = VLCApplication.getAppResources().getDrawable(sidebarEntry.drawableID);
-        int dp_32 = Util.convertDpToPx(32);
-        img.setBounds(0, 0, dp_32, dp_32);
-        textView.setCompoundDrawables(img, null, null, null);
+        if (img != null) {
+            int dp_32 = Util.convertDpToPx(32);
+            img.setBounds(0, 0, dp_32, dp_32);
+            textView.setCompoundDrawables(img, null, null, null);
+        }
 
         return v;
     }



More information about the Android mailing list