eliot-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Eliot-dev] eliot/wxwin mainframe.cc


From: eliot-dev
Subject: [Eliot-dev] eliot/wxwin mainframe.cc
Date: Sun, 08 Oct 2006 12:39:13 +0000

CVSROOT:        /cvsroot/eliot
Module name:    eliot
Changes by:     Olivier Teulière <ipkiss>      06/10/08 12:39:13

Modified files:
        wxwin          : mainframe.cc 

Log message:
        Do not crash when there is no dictionary and a search is requested

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/eliot/wxwin/mainframe.cc?cvsroot=eliot&r1=1.20&r2=1.21

Patches:
Index: mainframe.cc
===================================================================
RCS file: /cvsroot/eliot/eliot/wxwin/mainframe.cc,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- mainframe.cc        11 Aug 2006 22:17:54 -0000      1.20
+++ mainframe.cc        8 Oct 2006 12:39:13 -0000       1.21
@@ -999,7 +999,11 @@
 void
 MainFrame::Search()
 {
-    ((Training*)m_game)->removeTestPlay();
+    if (m_game == NULL || m_game->getDic() == NULL)
+    {
+        return;
+    }
+    static_cast<Training*>(m_game)->removeTestPlay();
 #ifdef ENABLE_RESLIST_IN_MAIN
     reslist->Search();
 #else
@@ -1015,7 +1019,11 @@
 void
 MainFrame::Play(int n)
 {
-    ((Training*)m_game)->removeTestPlay();
+    if (m_game == NULL)
+    {
+        return;
+    }
+    static_cast<Training*>(m_game)->removeTestPlay();
     if (n < 0)
        {
            debug("MainFrame::Play back %d\n",n);
@@ -1044,8 +1052,12 @@
 void
 MainFrame::TestPlay(int n)
 {
-    ((Training*)m_game)->removeTestPlay();
-    ((Training*)m_game)->testPlay(n);
+    if (m_game == NULL)
+    {
+        return;
+    }
+    static_cast<Training*>(m_game)->removeTestPlay();
+    static_cast<Training*>(m_game)->testPlay(n);
     UpdateFrames();
     UpdateStatusBar();
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]