Commit e7e52c09 authored by Alexander Ivanov's avatar Alexander Ivanov

Fix crash when unexpected chat history received. Close #165.

parent 9cbaa82d
...@@ -25,6 +25,7 @@ import org.jivesoftware.smack.packet.IQ.Type; ...@@ -25,6 +25,7 @@ import org.jivesoftware.smack.packet.IQ.Type;
import org.jivesoftware.smack.packet.Packet; import org.jivesoftware.smack.packet.Packet;
import com.xabber.android.data.Application; import com.xabber.android.data.Application;
import com.xabber.android.data.LogManager;
import com.xabber.android.data.NetworkException; import com.xabber.android.data.NetworkException;
import com.xabber.android.data.OnLoadListener; import com.xabber.android.data.OnLoadListener;
import com.xabber.android.data.account.AccountItem; import com.xabber.android.data.account.AccountItem;
...@@ -464,6 +465,13 @@ public class MessageArchiveManager implements OnPacketListener, ...@@ -464,6 +465,13 @@ public class MessageArchiveManager implements OnPacketListener,
return; return;
ChatStorage chatStorage = chatStorages.get(account, chat.getWith(), ChatStorage chatStorage = chatStorages.get(account, chat.getWith(),
chat.getStartString()); chat.getStartString());
if (chatStorage == null) {
LogManager.w(this, "Unexpected chat " + chat.getStartString()
+ " recevied by " + account + " from " + chat.getWith());
chatStorage = new ChatStorage(chat.getStart());
chatStorages.put(account, chat.getWith(), chat.getStartString(),
chatStorage);
}
String bareAddress = Jid.getBareAddress(chat.getWith()); String bareAddress = Jid.getBareAddress(chat.getWith());
HeaderSequence sequence; HeaderSequence sequence;
if (modification) if (modification)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment