OSDN Git Service

Don't crash if pay button was pressed when no friend is selected.
authorLatif Khalifa <latifer@streamgrid.net>
Sat, 8 Oct 2011 22:23:20 +0000 (22:23 +0000)
committerLatif Khalifa <latifer@streamgrid.net>
Sat, 8 Oct 2011 22:23:20 +0000 (22:23 +0000)
Fixed bug where "from" part of some messages was not printed in the chat console.

git-svn-id: https://radegast.googlecode.com/svn/trunk@1164 f7a694da-4d33-11de-9ad6-1127a62b9fcd

Radegast/Core/ChatBufferItem.cs
Radegast/GUI/Consoles/FriendsConsole.cs

index 21c07e9..3332304 100644 (file)
@@ -50,6 +50,8 @@ namespace Radegast
         public ChatBufferItem(DateTime timestamp, string from, UUID id, string text, ChatBufferTextStyle style)
         {
             this.timestamp = timestamp;
+            this.from = from;
+            this.id = id;
             this.text = text;
             this.style = style;
         }
index e5c7a90..c0eb655 100644 (file)
@@ -330,6 +330,8 @@ namespace Radegast
 
         private void btnProfile_Click(object sender, EventArgs e)
         {
+            if (selectedFriend == null) return;
+
             instance.MainForm.ShowAgentProfile(selectedFriend.Name, selectedFriend.UUID);
         }
 
@@ -368,11 +370,15 @@ namespace Radegast
 
         private void btnPay_Click(object sender, EventArgs e)
         {
+            if (selectedFriend == null) return;
+
             (new frmPay(instance, selectedFriend.UUID, selectedFriend.Name, false)).ShowDialog();
         }
 
         private void btnRemove_Click(object sender, EventArgs e)
         {
+            if (selectedFriend == null) return;
+
             client.Friends.TerminateFriendship(selectedFriend.UUID);
             RefreshFriendsList();
         }