ListBox logical error?

void ListBox::selectRowsBasedOnModifierKeys (const int row,
                                             ModifierKeys mods,
                                             const bool isMouseUpEvent)
{
    if (multipleSelection && (mods.isCommandDown() || alwaysFlipSelection))
    {
        flipRowSelection (row);
    }
    else if (multipleSelection && mods.isShiftDown() && lastRowSelected >= 0)
    {
        selectRangeOfRows (lastRowSelected, row);
    }
    else if ((! mods.isPopupMenu()) || ! isRowSelected (row))
    {
        selectRowInternal (row, false, ! (multipleSelection && (! isMouseUpEvent) && isRowSelected (row)), true);
    }
}

Should that last if clause in fact be && instead of ||?

It seems the intention is that it should not select the row if it’s already selected or the right mouse button was used, however it doesn’t have that effect by using logical OR.

If I switch it to && then I get the behaviour I’m after, which is that right clicking a row doesn’t select it. The other option would be else if (! (mods.isPopupMenu() || isRowSelected (row))), which seems like it may have been what was desired, since writing (! mods.isPopupMenu()) is somewhat pointless.