I am currently using Smack version 4.3.1 and building an Android application.
When creating a MUC I use the following
MultiUserChatManager mucManager = MultiUserChatManager.getInstanceFor(mConnection);
MultiUserChat muc = mucManager.getMultiUserChat(JidCreate.entityBareFrom(uniqueId + Constants.CHAT_MUC_RESOURCE_PREFIX + mConnection.getUser().asBareJid().getDomain().toString()));
Resourcepart nickname = Resourcepart.from(mConnection.getUser().asBareJid().toString());
muc.create(nickname);
Form form = muc.getConfigurationForm();
Form submitForm = form.createAnswerForm();
for (FormField formField : form.getFields()) {
submitForm.setDefaultAnswer(formField.getVariable());
}
muc.sendConfigurationForm(submitForm);
muc.addMessageListener(this);
for (String jid : jidList) {
muc.invite(JidCreate.entityBareFrom(jid), "");
}
It creates a MUC just fine and will send out invites. User’s using the same version connecting via other Xmpp connections other than Smack can join just fine and Smack can handle it but when a user joins from an older version of Smack the app crashes with the following stacktrace. This happens with MultiUserChat.java tries to handle the presence of the user joining.
New Fatal Issue - MultiUserChat.java line 226 - Android com.nightly SNAPSHOT-20190430 (15566843
--------- beginning of crash
05-01 13:59:47.965 11806-1395/com.android.nightly E/AndroidRuntime: FATAL EXCEPTION: Smack Cached Executor
Process: com.android.nightly, PID: 11806
java.lang.NullPointerException: Attempt to invoke virtual method 'org.jivesoftware.smackx.muc.MUCAffiliation org.jivesoftware.smackx.muc.packet.MUCItem.getAffiliation()' on a null object reference
at org.jivesoftware.smackx.muc.MultiUserChat$3$1.run(MultiUserChat.java:226)
at org.jivesoftware.smack.AsyncButOrdered$Handler.run(AsyncButOrdered.java:121)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:762)
We cannot update the Smack version of the other app since we do not have ownership over it.
Any help on how to handle this would be much appreciated! Thank you.