diff --git a/indra/newview/llconversationlog.cpp b/indra/newview/llconversationlog.cpp
index ff1f819d7d9804db920f09ef89feea30f0567f0a..65374b67f81eafb7d50309934f040e158c882032 100644
--- a/indra/newview/llconversationlog.cpp
+++ b/indra/newview/llconversationlog.cpp
@@ -237,7 +237,7 @@ void LLConversationLog::logConversation(const LLUUID& session_id, BOOL has_offli
 	const LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(session_id);
 	LLConversation* conversation = findConversation(session);
 
-    if (session)
+	if (session)
 	{
     	if (conversation)
 		{
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index cb03c1d2343a137a3776d44f0fad1f08c80ae64d..4c3d385d2dd8aa7cae416eef54ba4ee1c6650e8e 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -2542,6 +2542,13 @@ void LLIMMgr::addMessage(
 	bool link_name) // If this is true, then we insert the name and link it to a profile
 {
 	LLUUID other_participant_id = target_id;
+
+	// Agent can't create session with himself
+	if (other_participant_id == gAgentID)
+	{
+		return;
+	}
+
 	LLUUID new_session_id = session_id;
 	if (new_session_id.isNull())
 	{