textinput/peninputarc/gsplugin/gspeninputplugin/src/gspeninputmodel.cpp
changeset 13 3b79bedfdc20
parent 0 eb1f2e154e89
--- a/textinput/peninputarc/gsplugin/gspeninputplugin/src/gspeninputmodel.cpp	Tue Feb 02 01:02:04 2010 +0200
+++ b/textinput/peninputarc/gsplugin/gspeninputplugin/src/gspeninputmodel.cpp	Fri Apr 16 15:17:40 2010 +0300
@@ -793,13 +793,16 @@
 
     if (iInputLanguage == ELangPrcChinese)
         {
-        if (aIndex == 0 && ptiLang->HasInputMode(EPtiEnginePinyinByPhrase))
+        if( ptiLang != NULL )
             {
-            curInputMode = EPinyin;
-            }
-        else
-            {
-            curInputMode = EStroke;    
+            if (aIndex == 0 && ptiLang->HasInputMode(EPtiEnginePinyinByPhrase))
+                {
+                curInputMode = EPinyin;
+                }
+            else
+                {
+                curInputMode = EStroke;    
+                }
             }
 
         if (curInputMode != -1)
@@ -810,13 +813,16 @@
         }
     else if (iInputLanguage == ELangHongKongChinese) 
         {
-        if (aIndex == 0 && ptiLang->HasInputMode(EPtiEngineStrokeByPhrase))
+        if( ptiLang != NULL )
             {
-            curInputMode = EStroke;
-            }
-         else
-            {
-            curInputMode = ECangJie;   
+            if (aIndex == 0 && ptiLang->HasInputMode(EPtiEngineStrokeByPhrase))
+                {
+                curInputMode = EStroke;
+                }
+            else
+                {
+                curInputMode = ECangJie;   
+                }
             }
             
         if (curInputMode != -1)
@@ -827,29 +833,32 @@
         }
     else if (iInputLanguage == ELangTaiwanChinese)
         { 
-        if (aIndex == 0 && ptiLang->HasInputMode(EPtiEngineZhuyinByPhrase))
-            {
-            curInputMode = EZhuyin;
-            }
-        else if (aIndex == 0 && ptiLang->HasInputMode(EPtiEngineStrokeByPhrase))
-            {
-            curInputMode = EStroke;
-            }
-        else if (aIndex == 0 && ptiLang->HasInputMode(EPtiEnginePinyinByPhrase))
+        if( ptiLang != NULL )
             {
-            curInputMode = EPinyin;
-            }
-        else if (aIndex == 1 && ptiLang->HasInputMode(EPtiEngineStrokeByPhrase))
-            {
-            curInputMode = EStroke;
-            }
-        else if (aIndex == 1 && ptiLang->HasInputMode(EPtiEnginePinyinByPhrase))
-            {
-            curInputMode = EPinyin;
-            }
-        else if (aIndex == 2)
-            {
-            curInputMode = EPinyin;            
+            if (aIndex == 0 && ptiLang->HasInputMode(EPtiEngineZhuyinByPhrase))
+                {
+                curInputMode = EZhuyin;
+                }
+            else if (aIndex == 0 && ptiLang->HasInputMode(EPtiEngineStrokeByPhrase))
+                {
+                curInputMode = EStroke;
+                }
+            else if (aIndex == 0 && ptiLang->HasInputMode(EPtiEnginePinyinByPhrase))
+                {
+                curInputMode = EPinyin;
+                }
+            else if (aIndex == 1 && ptiLang->HasInputMode(EPtiEngineStrokeByPhrase))
+                {
+                curInputMode = EStroke;
+                }
+            else if (aIndex == 1 && ptiLang->HasInputMode(EPtiEnginePinyinByPhrase))
+                {
+                curInputMode = EPinyin;
+                }
+            else if (aIndex == 2)
+                {
+                curInputMode = EPinyin;            
+                }
             }
 
         if (curInputMode != -1)
@@ -869,7 +878,11 @@
     TInt index = 0;
     TInt skipCount = 0;
     MPtiLanguage* ptiLang = iPtiEngine->GetLanguage(iInputLanguage & KGSLanguageMask);    
-
+    
+    if( ptiLang == NULL )
+        {
+        return index;
+        }
     if (iInputLanguage == ELangPrcChinese)
         {
         if (iInputMode == EPinyin && ptiLang->HasInputMode(EPtiEnginePinyinByPhrase))
@@ -972,8 +985,12 @@
         {
         return;
         }
-        
-    MPtiLanguage* ptiLang = iPtiEngine->GetLanguage(iInputLanguage & KGSLanguageMask);                
+    
+    MPtiLanguage* ptiLang = iPtiEngine->GetLanguage(iInputLanguage & KGSLanguageMask);    
+    if( ptiLang == NULL )
+        {
+        return;
+        }
     switch(iInputLanguage)
         {
         case ELangPrcChinese: