From 1b8ea8f3d5fa5b59803e15bfab10e01522888c55 Mon Sep 17 00:00:00 2001
From: Ciaran Gultnieks <ciaran@ciarang.com>
Date: Sun, 17 Nov 2013 11:33:05 +0000
Subject: [PATCH] Handle unrecognises antifeatures more gracefully

This allows us to add new ones without making a mess in the client.
Prior to this change it would add empty lines, and also if the only
antifeature was an unrecognised one, would enable the antifeature view
box but with nothing in it. It should now ignore them completely.
---
 src/org/fdroid/fdroid/AppDetails.java | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/org/fdroid/fdroid/AppDetails.java b/src/org/fdroid/fdroid/AppDetails.java
index 977999719..7759bf80e 100644
--- a/src/org/fdroid/fdroid/AppDetails.java
+++ b/src/org/fdroid/fdroid/AppDetails.java
@@ -534,10 +534,18 @@ public class AppDetails extends ListActivity {
         tv = (TextView) infoView.findViewById(R.id.antifeatures);
         if (app.antiFeatures != null) {
             StringBuilder sb = new StringBuilder();
-            for (String af : app.antiFeatures)
-                sb.append("\t• " + descAntiFeature(af) + "\n");
-            if (sb.length() > 0) sb.setLength(sb.length() - 1);
-            tv.setText(sb.toString());
+            for (String af : app.antiFeatures) {
+                String afdesc = descAntiFeature(af);
+                if (afdesc != null) {
+                    sb.append("\t• " + afdesc + "\n");
+                }
+            }
+            if (sb.length() > 0) {
+                sb.setLength(sb.length() - 1);
+                tv.setText(sb.toString());
+            } else {
+                tv.setVisibility(View.GONE);
+            }
         } else {
             tv.setVisibility(View.GONE);
         }
@@ -554,7 +562,7 @@ public class AppDetails extends ListActivity {
             return getString(R.string.antinonfreeadlist);
         if (af.equals("NonFreeDep"))
             return getString(R.string.antinonfreedeplist);
-        return "";
+        return null;
     }
 
     private void updateViews() {