From b855c745e02be7fdd40a59f22f2da4bb1dc77bfe Mon Sep 17 00:00:00 2001 From: Peter Serwylo Date: Tue, 16 Aug 2016 00:20:19 +1000 Subject: [PATCH] Ensure that description is not null when parsing index. At time of writing (and for some time before), fdroidserver has forced a description of "No description available" for apps which don't have descriptions at all: * https://gitlab.com/fdroid/fdroidserver/blob/0.6.0/fdroidserver/metadata.py#L876 However, if the description is not set for whatever reason, it should not crash the client. --- app/src/main/java/org/fdroid/fdroid/RepoXMLHandler.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/src/main/java/org/fdroid/fdroid/RepoXMLHandler.java b/app/src/main/java/org/fdroid/fdroid/RepoXMLHandler.java index f15b25a16..780d82f55 100644 --- a/app/src/main/java/org/fdroid/fdroid/RepoXMLHandler.java +++ b/app/src/main/java/org/fdroid/fdroid/RepoXMLHandler.java @@ -265,6 +265,11 @@ public class RepoXMLHandler extends DefaultHandler { } else if ("application".equals(localName) && curapp == null) { curapp = new App(); curapp.packageName = attributes.getValue("", "id"); + + // To appease the NON NULL constraint in the DB. Usually there is a description, and it + // is quite difficult to get an app to _not_ have a description when using fdroidserver. + // However, it shouldn't crash the client when this happens. + curapp.description = ""; } else if ("package".equals(localName) && curapp != null && curapk == null) { curapk = new Apk(); curapk.packageName = curapp.packageName;