From d2d0fe29b7ed3c9f06f7ecc6f80a31556d1e2f31 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Mon, 10 Sep 2012 22:55:02 +0100
Subject: [PATCH] Resolves: rhbz#855972 crash on switching to outline view

Change-Id: Ic2675e9d1d8ce6bb67e9c9e4db292f79c4240409
---
 svx/source/form/fmvwimp.cxx |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx
index ac668eb..e021cdf 100644
--- a/svx/source/form/fmvwimp.cxx
+++ b/svx/source/form/fmvwimp.cxx
@@ -931,8 +931,10 @@ IMPL_LINK(FmXFormView, OnAutoFocus, void*, /*EMPTYTAG*/)
     do
     {
 
+    SdrPageView *pPageView = m_pView ? m_pView->GetSdrPageView() : NULL;
+    SdrPage *pSdrPage = pPageView ? pPageView->GetPage() : NULL;
     // get the forms collection of the page we belong to
-    FmFormPage* pPage = m_pView ? PTR_CAST( FmFormPage, m_pView->GetSdrPageView()->GetPage() ) : NULL;
+    FmFormPage* pPage = PTR_CAST( FmFormPage, pSdrPage );
     Reference< XIndexAccess > xForms( pPage ? Reference< XIndexAccess >( pPage->GetForms(), UNO_QUERY ) : Reference< XIndexAccess >() );
 
     const PFormViewPageWindowAdapter pAdapter = m_aPageWindowAdapters.empty() ? NULL : m_aPageWindowAdapters[0];
-- 
1.7.10.4

