Merge pull request #6830 from thundernest/fix_MessageList_crash
MessageList: Don't crash when being launched with invalid EXTRA_SEARCH value
This commit is contained in:
commit
df9abbd678
2 changed files with 9 additions and 3 deletions
|
@ -355,6 +355,8 @@ public class LocalSearch implements SearchSpecification {
|
|||
mManualSearch = (in.readByte() == 1);
|
||||
mAccountUuids.addAll(in.createStringArrayList());
|
||||
mConditions = in.readParcelable(LocalSearch.class.getClassLoader());
|
||||
mLeafSet = (mConditions == null) ? null : mConditions.getLeafSet();
|
||||
if (mConditions != null) {
|
||||
mLeafSet = mConditions.getLeafSet();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -465,7 +465,7 @@ open class MessageList :
|
|||
val messageReference = MessageReference.parse(messageReferenceString)
|
||||
|
||||
if (messageReference != null) {
|
||||
val search = if (intent.hasExtra(EXTRA_SEARCH)) {
|
||||
val search = if (intent.hasByteArrayExtra(EXTRA_SEARCH)) {
|
||||
ParcelableUtil.unmarshall(intent.getByteArrayExtra(EXTRA_SEARCH), LocalSearch.CREATOR)
|
||||
} else {
|
||||
messageReference.toLocalSearch()
|
||||
|
@ -477,7 +477,7 @@ open class MessageList :
|
|||
messageViewOnly = intent.getBooleanExtra(EXTRA_MESSAGE_VIEW_ONLY, false),
|
||||
)
|
||||
}
|
||||
} else if (intent.hasExtra(EXTRA_SEARCH)) {
|
||||
} else if (intent.hasByteArrayExtra(EXTRA_SEARCH)) {
|
||||
// regular LocalSearch object was passed
|
||||
val search = ParcelableUtil.unmarshall(intent.getByteArrayExtra(EXTRA_SEARCH), LocalSearch.CREATOR)
|
||||
val noThreading = intent.getBooleanExtra(EXTRA_NO_THREADING, false)
|
||||
|
@ -1554,3 +1554,7 @@ open class MessageList :
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun Intent.hasByteArrayExtra(name: String): Boolean {
|
||||
return getByteArrayExtra(name) != null
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue