From 36f3887c5fcd53b76343247868fa95e72b2b0044 Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Fri, 19 Jun 2015 20:09:04 +0200 Subject: [PATCH] handle empty filename in decrypt list --- .../sufficientlysecure/keychain/ui/DecryptListFragment.java | 6 +++++- OpenKeychain/src/main/res/values/strings.xml | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptListFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptListFragment.java index d54512076..275212ac8 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptListFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptListFragment.java @@ -34,6 +34,7 @@ import android.os.Bundle; import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; +import android.text.TextUtils; import android.view.ContextMenu; import android.view.ContextMenu.ContextMenuInfo; import android.view.LayoutInflater; @@ -476,7 +477,10 @@ public class DecryptListFragment KeyFormattingUtils.setStatus(mContext, holder, model.mResult); OpenPgpMetadata metadata = model.mResult.getDecryptMetadata(); - holder.vFilename.setText(metadata.getFilename()); + + String filename = metadata.getFilename(); + holder.vFilename.setText( + !TextUtils.isEmpty(filename) ? filename : mContext.getString(R.string.filename_unknown)); long size = metadata.getOriginalSize(); if (size == -1 || size == 0) { diff --git a/OpenKeychain/src/main/res/values/strings.xml b/OpenKeychain/src/main/res/values/strings.xml index 4529c2463..1532ba204 100644 --- a/OpenKeychain/src/main/res/values/strings.xml +++ b/OpenKeychain/src/main/res/values/strings.xml @@ -1334,5 +1334,6 @@ "Error loading keys!" "(error, empty log)" "Could not read input to decrypt!" + ]]>