aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-05-10 11:03:32 +0200
committeriNPUTmice <daniel@gultsch.de>2014-05-10 11:03:32 +0200
commit8632954e61c11bfa32cc192f0dcd4d3b2a72c7f0 (patch)
treec949bea4940ff81cc3d1555b2d4d6af1a4832445 /src
parentef0bc6714a71555b05ca3dea10c274a40605810c (diff)
fixed possible npe and possible exception
Diffstat (limited to 'src')
-rw-r--r--src/eu/siacs/conversations/ui/ConversationFragment.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/eu/siacs/conversations/ui/ConversationFragment.java b/src/eu/siacs/conversations/ui/ConversationFragment.java
index 6850ac54f..06bbc3a5e 100644
--- a/src/eu/siacs/conversations/ui/ConversationFragment.java
+++ b/src/eu/siacs/conversations/ui/ConversationFragment.java
@@ -198,8 +198,12 @@ public class ConversationFragment extends Fragment {
boolean error = false;
if (message.getType() == Message.TYPE_IMAGE) {
String[] fileParams = message.getBody().split(",");
- long size = Long.parseLong(fileParams[0]);
- filesize = size / 1024 + " KB";
+ try {
+ long size = Long.parseLong(fileParams[0]);
+ filesize = size / 1024 + " KB";
+ } catch (NumberFormatException e) {
+ filesize = "0 KB";
+ }
}
switch (message.getStatus()) {
case Message.STATUS_UNSEND:
@@ -585,6 +589,9 @@ public class ConversationFragment extends Fragment {
}
public void updateMessages() {
+ if (getView()==null) {
+ return;
+ }
ConversationActivity activity = (ConversationActivity) getActivity();
if (this.conversation != null) {
for (Message message : this.conversation.getMessages()) {