Resolves: tdf#128599 null deref

Change-Id: If71a32b15b5ffab11185e2ce253ab65faf7e6ac3
Reviewed-on: https://gerrit.libreoffice.org/82056
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/vcl/source/window/event.cxx b/vcl/source/window/event.cxx
index e6d52a2..edfa7fd 100644
--- a/vcl/source/window/event.cxx
+++ b/vcl/source/window/event.cxx
@@ -89,6 +89,17 @@ bool Window::PreNotify( NotifyEvent& rNEvt )
    return bDone;
}

namespace
{
    bool parentNotDialogControl(Window* pWindow)
    {
        vcl::Window* pParent = getNonLayoutParent(pWindow);
        if (!pParent)
            return true;
        return ((pParent->GetStyle() & (WB_DIALOGCONTROL | WB_NODIALOGCONTROL)) != WB_DIALOGCONTROL);
    }
}

bool Window::EventNotify( NotifyEvent& rNEvt )
{
    bool bRet = false;
@@ -172,8 +183,7 @@ bool Window::EventNotify( NotifyEvent& rNEvt )
        // if the parent also has dialog control activated, the parent takes over control
        if ( (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT) || (rNEvt.GetType() == MouseNotifyEvent::KEYUP) )
        {
            if ( ImplIsOverlapWindow() ||
                 ((getNonLayoutParent(this)->GetStyle() & (WB_DIALOGCONTROL | WB_NODIALOGCONTROL)) != WB_DIALOGCONTROL) )
            if (ImplIsOverlapWindow() || parentNotDialogControl(this))
            {
                bRet = ImplDlgCtrl( *rNEvt.GetKeyEvent(), rNEvt.GetType() == MouseNotifyEvent::KEYINPUT );
            }