Fix a NullPointerException in ChangeStatus.
authorDa Risk <da_risk@elyzion.net>
Mon, 05 Sep 2011 09:31:22 +0200
changeset 924 c82293948d2f
parent 923 6e5999172eb1
child 926 b75998f79089
Fix a NullPointerException in ChangeStatus.
src/com/beem/project/beem/service/XmppConnectionAdapter.java
src/com/beem/project/beem/service/aidl/IXmppFacade.aidl
src/com/beem/project/beem/ui/ChangeStatus.java
--- a/src/com/beem/project/beem/service/XmppConnectionAdapter.java	Thu Aug 25 14:51:07 2011 +0200
+++ b/src/com/beem/project/beem/service/XmppConnectionAdapter.java	Mon Sep 05 09:31:22 2011 +0200
@@ -417,7 +417,7 @@
     /**
      * Get the user informations.
      *
-     * @return the user infos
+     * @return the user infos or null if not logged
      */
     public UserInfo getUserInfo() {
 	return mUserInfo;
--- a/src/com/beem/project/beem/service/aidl/IXmppFacade.aidl	Thu Aug 25 14:51:07 2011 +0200
+++ b/src/com/beem/project/beem/service/aidl/IXmppFacade.aidl	Mon Sep 05 09:31:22 2011 +0200
@@ -103,6 +103,10 @@
 
     void disableAvatarPublishing();
 
+    /**
+     * Get the user informations.
+     * @return null if not connected
+     */
     UserInfo getUserInfo();
 
      IPrivacyListManager getPrivacyListManager();
--- a/src/com/beem/project/beem/ui/ChangeStatus.java	Thu Aug 25 14:51:07 2011 +0200
+++ b/src/com/beem/project/beem/ui/ChangeStatus.java	Mon Sep 05 09:31:22 2011 +0200
@@ -355,8 +355,10 @@
     private void displayCurrentAvatar() {
 	try {
 	    UserInfo ui = mXmppFacade.getUserInfo();
+	    if (ui == null)
+		return;
 	    String avatarId = ui.getAvatarId();
-	    Log.d(TAG, "User info ; avatar id " + avatarId);
+	    Log.d(TAG, "User info : avatar id " + avatarId);
 	    if (avatarId != null) {
 		Uri uri = AvatarProvider.CONTENT_URI.buildUpon().appendPath(avatarId).build();
 		mAvatar.setImageURI(uri);