From 229172340bb47d4bf6a090fa29c57fe59c56d130 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Kubitz?= Date: Thu, 10 Oct 2024 15:53:07 +0200 Subject: [PATCH] MarkerComparator.saveState: fix ArrayIndexOutOfBoundsException as logged during UiTestSuite --- .../eclipse/ui/internal/views/markers/MarkerComparator.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/MarkerComparator.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/MarkerComparator.java index e84d3254602..1f6f876d76a 100644 --- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/MarkerComparator.java +++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/MarkerComparator.java @@ -187,7 +187,9 @@ void restore(IMemento memento) { * Save the current sort field in the memento. */ void saveState(IMemento memento) { - memento.putString(PRIMARY_SORT_FIELD_TAG, MarkerSupportInternalUtilities.getId(fields[0])); + if (fields != null && fields.length > 0) { + memento.putString(PRIMARY_SORT_FIELD_TAG, MarkerSupportInternalUtilities.getId(fields[0])); + } Iterator descendingIterator = descendingFields.iterator(); while (descendingIterator.hasNext()) { memento.createChild(DESCENDING_FIELDS, (MarkerSupportInternalUtilities.getId(descendingIterator.next())));