cid#1528432 Argument cannot be negative

Change-Id: Ic55c524a9ec8ae9a4df7f96d284d822616fa3b54
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151241
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx
index 94d9044..01f5f39 100644
--- a/sc/source/ui/view/gridwin2.cxx
+++ b/sc/source/ui/view/gridwin2.cxx
@@ -746,6 +746,9 @@ void ScGridWindow::UpdateDPPopupMenuForFieldChange()
        return;

    tools::Long nIndex = mpDPFieldPopup->getField();
    if (nIndex < 0)
        return;

    tools::Long nDimIndex = pDPData->maFieldIndices[nIndex];
    if (nDimIndex == pDPData->mnDim)
        return;