Blob Blame History Raw
From 76cf006837fdb687ce0a34ac673f3b8531b19700 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Thu, 15 Sep 2011 12:32:51 +0100
Subject: [PATCH] Resolves: rhbz#738255 avoid crash on NULL pointer

---
 sc/source/ui/app/inputhdl.cxx |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 1524397..c30a8fd 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -2469,13 +2469,16 @@ void ScInputHandler::EnterHandler( sal_uInt8 nBlockMode )
             ScDocument* pDoc = pActiveViewSh->GetViewData()->GetDocument();
             // #i67990# don't use pLastPattern in EnterHandler
             const ScPatternAttr* pPattern = pDoc->GetPattern( aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Tab() );
-            SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
-            // without conditional format, as in ScColumn::SetString
-            sal_uInt32 nFormat = pPattern->GetNumberFormat( pFormatter );
-            double nVal;
-            if ( pFormatter->IsNumberFormat( aString, nFormat, nVal ) )
+            if (pPattern)
             {
-                bSpellErrors = false;       // ignore the spelling errors
+                SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
+                // without conditional format, as in ScColumn::SetString
+                sal_uInt32 nFormat = pPattern->GetNumberFormat( pFormatter );
+                double nVal;
+                if ( pFormatter->IsNumberFormat( aString, nFormat, nVal ) )
+                {
+                    bSpellErrors = false;       // ignore the spelling errors
+                }
             }
         }
     }
-- 
1.7.6