diff options
author | Christian Schneppe <christian@pix-art.de> | 2019-06-08 14:51:06 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2019-06-08 14:51:06 +0200 |
commit | 7cf5b7c6fa44d8b0a776472212f2a0a9f81f8edf (patch) | |
tree | 1435cadf1eeb8667e9396edc83e9a5ada0ab70b3 /src | |
parent | 6856e84abd40835e78b3873a4070709faa4604bf (diff) |
fix some more NPE
Diffstat (limited to 'src')
5 files changed, 14 insertions, 7 deletions
diff --git a/src/main/java/de/pixart/messenger/persistance/FileBackend.java b/src/main/java/de/pixart/messenger/persistance/FileBackend.java index 066cd21be..8fb5aa406 100644 --- a/src/main/java/de/pixart/messenger/persistance/FileBackend.java +++ b/src/main/java/de/pixart/messenger/persistance/FileBackend.java @@ -1151,15 +1151,15 @@ public class FileBackend { String VCardName = ""; try { VCard = Ezvcard.parse(file).first(); + if (VCard != null) { + final String version = VCard.getVersion().toString(); + Log.d(Config.LOGTAG, "VCard version: " + version); + final String name = VCard.getFormattedName().getValue(); + VCardName = " (" + name + ")"; + } } catch (IOException e) { e.printStackTrace(); } - if (VCard != null) { - final String version = VCard.getVersion().toString(); - Log.d(Config.LOGTAG, "VCard version: " + version); - final String name = VCard.getFormattedName().getValue(); - VCardName = " (" + name + ")"; - } try { byte[] data = VCardName.getBytes("UTF-8"); VCardName = Base64.encodeToString(data, Base64.DEFAULT); diff --git a/src/main/java/de/pixart/messenger/services/ExportBackupService.java b/src/main/java/de/pixart/messenger/services/ExportBackupService.java index 6bb10544f..8a383762f 100644 --- a/src/main/java/de/pixart/messenger/services/ExportBackupService.java +++ b/src/main/java/de/pixart/messenger/services/ExportBackupService.java @@ -233,6 +233,9 @@ public class ExportBackupService extends Service { public int onStartCommand(Intent intent, int flags, int startId) { if (running.compareAndSet(false, true)) { new Thread(() -> { + if (intent == null) { + return; + } Bundle extras = null; if (intent != null && intent.getExtras() != null) { extras = intent.getExtras(); diff --git a/src/main/java/de/pixart/messenger/ui/XmppActivity.java b/src/main/java/de/pixart/messenger/ui/XmppActivity.java index cea89ebb4..bcdcafe37 100644 --- a/src/main/java/de/pixart/messenger/ui/XmppActivity.java +++ b/src/main/java/de/pixart/messenger/ui/XmppActivity.java @@ -1022,6 +1022,9 @@ public abstract class XmppActivity extends ActionBarActivity { } private boolean AdHocInvite(Account account) { + if (!xmppConnectionServiceBound) { + return false; + } XmppConnection.Features features = account.getXmppConnection().getFeatures(); Log.d(Config.LOGTAG, "Invite available: " + features.adhocinvite); return features.adhocinvite; diff --git a/src/main/java/de/pixart/messenger/ui/util/MucDetailsContextMenuHelper.java b/src/main/java/de/pixart/messenger/ui/util/MucDetailsContextMenuHelper.java index 7775bc114..aaf2a39ec 100644 --- a/src/main/java/de/pixart/messenger/ui/util/MucDetailsContextMenuHelper.java +++ b/src/main/java/de/pixart/messenger/ui/util/MucDetailsContextMenuHelper.java @@ -127,7 +127,7 @@ public final class MucDetailsContextMenuHelper { sendPrivateMessage.setEnabled(mucOptions.allowPm()); } else { sendPrivateMessage.setVisible(true); - sendPrivateMessage.setVisible(!isGroupChat && mucOptions.allowPm() && (user != null && user.getRole().ranks(MucOptions.Role.VISITOR))); + sendPrivateMessage.setEnabled(user != null && mucOptions.allowPm() && user.getRole().ranks(MucOptions.Role.VISITOR)); } } diff --git a/src/main/java/de/pixart/messenger/utils/RichPreview.java b/src/main/java/de/pixart/messenger/utils/RichPreview.java index 5087081ec..d0ced8233 100644 --- a/src/main/java/de/pixart/messenger/utils/RichPreview.java +++ b/src/main/java/de/pixart/messenger/utils/RichPreview.java @@ -62,6 +62,7 @@ public class RichPreview { ObjectInputStream is = null; final File file = new File(context.getCacheDir(), RICH_LINK_METADATA + "/" + filename); if (file.exists()) { + // todo add this into a cron job Calendar time = Calendar.getInstance(); time.add(Calendar.DAY_OF_YEAR, -7); Date lastModified = new Date(file.lastModified()); |