tdf#120703 PVS: Silence V522 warnings

V522 There might be dereferencing of a potential null pointer.

Change-Id: I680f1628133216de6336ac5ffa846447ffd55a41
Reviewed-on: https://gerrit.libreoffice.org/70352
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
diff --git a/basic/source/runtime/dllmgr-x64.cxx b/basic/source/runtime/dllmgr-x64.cxx
index 4c5973f..a56aeee 100644
--- a/basic/source/runtime/dllmgr-x64.cxx
+++ b/basic/source/runtime/dllmgr-x64.cxx
@@ -159,8 +159,9 @@
        case SbxOBJECT:
            {
                std::size_t n = 1;
                SbxArray * props = dynamic_cast<SbxObject*>( variable->GetObject() )->
                    GetProperties();
                SbxObject* pobj = dynamic_cast<SbxObject*>(variable->GetObject());
                assert(pobj);
                SbxArray* props = pobj->GetProperties();
                for (sal_uInt16 i = 0; i < props->Count(); ++i) {
                    n = std::max(n, alignment(props->Get(i)));
                }
@@ -175,6 +176,7 @@
        }
    } else {
        SbxDimArray * arr = dynamic_cast<SbxDimArray*>( variable->GetObject() );
        assert(arr);
        int dims = arr->GetDims();
        std::vector< sal_Int32 > low(dims);
        for (int i = 0; i < dims; ++i) {
@@ -210,8 +212,9 @@
    MarshalData & data)
{
    OSL_ASSERT(variable != nullptr);
    SbxArray * props = dynamic_cast<SbxObject*>( variable->GetObject() )->
        GetProperties();
    SbxObject* pobj = dynamic_cast<SbxObject*>(variable->GetObject());
    assert(pobj);
    SbxArray* props = pobj->GetProperties();
    for (sal_uInt16 i = 0; i < props->Count(); ++i) {
        ErrCode e = marshal(false, props->Get(i), false, blob, offset, data);
        if (e != ERRCODE_NONE) {
@@ -227,6 +230,7 @@
{
    OSL_ASSERT(variable != nullptr);
    SbxDimArray * arr = dynamic_cast<SbxDimArray*>( variable->GetObject() );
    assert(arr);
    int dims = arr->GetDims();
    std::vector< sal_Int32 > low(dims);
    std::vector< sal_Int32 > up(dims);
@@ -402,8 +406,9 @@
                    align(
                        reinterpret_cast< sal_uIntPtr >(data),
                        alignment(variable)));
                SbxArray * props = dynamic_cast<SbxObject*>( variable->GetObject() )->
                    GetProperties();
                SbxObject* pobj = dynamic_cast<SbxObject*>(variable->GetObject());
                assert(pobj);
                SbxArray* props = pobj->GetProperties();
                for (sal_uInt16 i = 0; i < props->Count(); ++i) {
                    data = unmarshal(props->Get(i), data);
                }
@@ -421,6 +426,7 @@
        }
    } else {
        SbxDimArray * arr = dynamic_cast<SbxDimArray*>( variable->GetObject() );
        assert(arr);
        int dims = arr->GetDims();
        std::vector< sal_Int32 > low(dims);
        std::vector< sal_Int32 > up(dims);
diff --git a/basic/source/runtime/dllmgr-x86.cxx b/basic/source/runtime/dllmgr-x86.cxx
index 347f9ad..74b470d 100644
--- a/basic/source/runtime/dllmgr-x86.cxx
+++ b/basic/source/runtime/dllmgr-x86.cxx
@@ -166,8 +166,9 @@
        case SbxOBJECT:
            {
                std::size_t n = 1;
                SbxArray * props = dynamic_cast<SbxObject*>( variable->GetObject() )->
                    GetProperties();
                SbxObject* pobj = dynamic_cast<SbxObject*>(variable->GetObject());
                assert(pobj);
                SbxArray* props = pobj->GetProperties();
                for (sal_uInt16 i = 0; i < props->Count(); ++i) {
                    n = std::max(n, alignment(props->Get(i)));
                }
@@ -182,6 +183,7 @@
        }
    } else {
        SbxDimArray * arr = dynamic_cast<SbxDimArray*>( variable->GetObject() );
        assert(arr);
        int dims = arr->GetDims();
        std::vector< sal_Int32 > low(dims);
        for (int i = 0; i < dims; ++i) {
@@ -218,8 +220,9 @@
    MarshalData & data)
{
    OSL_ASSERT(variable != 0);
    SbxArray * props = dynamic_cast<SbxObject*>( variable->GetObject() )->
        GetProperties();
    SbxObject* pobj = dynamic_cast<SbxObject*>(variable->GetObject());
    assert(pobj);
    SbxArray* props = pobj->GetProperties();
    for (sal_uInt16 i = 0; i < props->Count(); ++i) {
        ErrCode e = marshal(false, props->Get(i), false, blob, offset, data);
        if (e != ERRCODE_NONE) {
@@ -235,6 +238,7 @@
{
    OSL_ASSERT(variable != 0);
    SbxDimArray * arr = dynamic_cast<SbxDimArray*>( variable->GetObject() );
    assert(arr);
    int dims = arr->GetDims();
    std::vector< sal_Int32 > low(dims);
    std::vector< sal_Int32 > up(dims);
@@ -410,8 +414,9 @@
                    align(
                        reinterpret_cast< sal_uIntPtr >(data),
                        alignment(variable)));
                SbxArray * props = dynamic_cast<SbxObject*>( variable->GetObject() )->
                    GetProperties();
                SbxObject* pobj = dynamic_cast<SbxObject*>(variable->GetObject());
                assert(pobj);
                SbxArray* props = pobj->GetProperties();
                for (sal_uInt16 i = 0; i < props->Count(); ++i) {
                    data = unmarshal(props->Get(i), data);
                }
@@ -429,6 +434,7 @@
        }
    } else {
        SbxDimArray * arr = dynamic_cast<SbxDimArray*>( variable->GetObject() );
        assert(arr);
        int dims = arr->GetDims();
        std::vector< sal_Int32 > low(dims);
        std::vector< sal_Int32 > up(dims);
diff --git a/chart2/source/controller/dialogs/DialogModel.cxx b/chart2/source/controller/dialogs/DialogModel.cxx
index a648aff..11a616a 100644
--- a/chart2/source/controller/dialogs/DialogModel.cxx
+++ b/chart2/source/controller/dialogs/DialogModel.cxx
@@ -854,6 +854,7 @@
{
    uno::Reference< frame::XModel > xModel = getChartModel();
    ChartModel* pModel = dynamic_cast<ChartModel*>(xModel.get());
    assert(pModel);
    return *pModel;
}

diff --git a/sfx2/source/inet/inettbc.cxx b/sfx2/source/inet/inettbc.cxx
index a8f42db..64bc249 100644
--- a/sfx2/source/inet/inettbc.cxx
+++ b/sfx2/source/inet/inettbc.cxx
@@ -229,6 +229,7 @@
        }

        const SfxStringItem *pURL = dynamic_cast< const SfxStringItem* >(pState);
        assert(pURL);
        INetURLObject aURL( pURL->GetValue() );
        INetProtocol eProt = aURL.GetProtocol();
        if ( eProt == INetProtocol::File )
diff --git a/svx/source/form/filtnav.cxx b/svx/source/form/filtnav.cxx
index a05e6a5..5bcd6a4 100644
--- a/svx/source/form/filtnav.cxx
+++ b/svx/source/form/filtnav.cxx
@@ -294,7 +294,7 @@
                              const OUString& rText)
{
    FmFormItem* pFormItem = dynamic_cast<FmFormItem*>( pFilterItem->GetParent()->GetParent()  );

    assert(pFormItem);
    try
    {
        Reference< XFilterController > xController( pFormItem->GetController(), UNO_QUERY_THROW );
@@ -788,6 +788,7 @@
bool FmFilterModel::ValidateText(FmFilterItem const * pItem, OUString& rText, OUString& rErrorMsg) const
{
    FmFormItem* pFormItem = dynamic_cast<FmFormItem*>( pItem->GetParent()->GetParent()  );
    assert(pFormItem);
    try
    {
        Reference< XFormController > xFormController( pFormItem->GetController() );
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 9e061eb..ee82f15 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -1484,6 +1484,7 @@
                {
                    // #i28701#
                    SwAnchoredObject* pAnchoredObj = (*pFrame->GetDrawObjs())[i];
                    assert(pAnchoredObj);

                    // determine if anchored object has to be
                    // formatted and, in case, format it
diff --git a/sw/source/core/undo/docundo.cxx b/sw/source/core/undo/docundo.cxx
index 73105e2..06cf409 100644
--- a/sw/source/core/undo/docundo.cxx
+++ b/sw/source/core/undo/docundo.cxx
@@ -673,15 +673,13 @@

    OUString const comment(pRepeatAction->GetComment());
    OUString const rcomment(pRepeatAction->GetRepeatComment(rContext));
    auto const*const pListAction(dynamic_cast<SfxListUndoAction *>(pRepeatAction));
    auto const*const pSwAction(dynamic_cast<SwUndo *>(pRepeatAction));
    if (!pListAction && !pSwAction)
    {
    SwUndoId nId;
    if (auto const* const pSwAction = dynamic_cast<SwUndo*>(pRepeatAction))
        nId = pSwAction->GetId();
    else if (auto const* const pListAction = dynamic_cast<SfxListUndoAction*>(pRepeatAction))
        nId = static_cast<SwUndoId>(pListAction->GetId());
    else
        return false;
    }
    SwUndoId const nId(pSwAction
            ? pSwAction->GetId()
            : static_cast<SwUndoId>(pListAction->GetId()));
    if (DoesUndo())
    {
        ViewShellId nViewShellId(-1);
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index e4ce856..f1c56fa 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -4174,8 +4174,7 @@
    {
        SwExtraRedline* pExtraRedline = aExtraRedlineTable.GetRedline(nCurRedlinePos);
        const SwTableRowRedline* pTableRowRedline = dynamic_cast<const SwTableRowRedline*>(pExtraRedline);
        const SwTableLine *pRedTabLine = pTableRowRedline ? &pTableRowRedline->GetTableLine() : nullptr;
        if (pRedTabLine == pTabLine)
        if (pTableRowRedline && &pTableRowRedline->GetTableLine() == pTabLine)
        {
            // Redline for this table row
            const SwRedlineData& aRedlineData = pTableRowRedline->GetRedlineData();
@@ -4220,8 +4219,7 @@
    {
        SwExtraRedline* pExtraRedline = aExtraRedlineTable.GetRedline(nCurRedlinePos);
        const SwTableCellRedline* pTableCellRedline = dynamic_cast<const SwTableCellRedline*>(pExtraRedline);
        const SwTableBox *pRedTabBox = pTableCellRedline ? &pTableCellRedline->GetTableBox() : nullptr;
        if (pRedTabBox == pTabBox)
        if (pTableCellRedline && &pTableCellRedline->GetTableBox() == pTabBox)
        {
            // Redline for this table cell
            const SwRedlineData& aRedlineData = pTableCellRedline->GetRedlineData();