Added more pointer error checking to the wxvbam build.
git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@1260 a31d4220-a93d-0410-bf67-fe4944624d44
This commit is contained in:
parent
d54845210f
commit
a262024135
|
@ -474,7 +474,7 @@ class PrintDialog : public wxEvtHandler, public wxPrintout
|
|||
public:
|
||||
PrintDialog(const u16 *data, int lines, bool cont);
|
||||
~PrintDialog();
|
||||
int ShowModal() { return wxGetApp().frame->ShowModal(dlg); }
|
||||
int ShowModal() {CheckPointer(wxGetApp().frame); return wxGetApp().frame->ShowModal(dlg); }
|
||||
private:
|
||||
void DoSave(wxCommandEvent&);
|
||||
void DoPrint(wxCommandEvent&);
|
||||
|
|
|
@ -616,6 +616,7 @@ void MainFrame::MenuPopped(wxMenuEvent &evt)
|
|||
// uses dialog_opened as a nesting counter
|
||||
int MainFrame::ShowModal(wxDialog *dlg)
|
||||
{
|
||||
CheckPointer(dlg);
|
||||
StartModal();
|
||||
int ret = dlg->ShowModal();
|
||||
StopModal();
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
#define WX_WXVBAM_H
|
||||
|
||||
#include <list>
|
||||
#include <typeinfo>
|
||||
#include <stdexcept>
|
||||
#include <wx/propdlg.h>
|
||||
|
||||
#include "wxhead.h"
|
||||
|
@ -25,6 +27,18 @@
|
|||
#include "../gb/gbCheats.h"
|
||||
#include "../gba/Cheats.h"
|
||||
|
||||
template <typename T>
|
||||
void CheckPointer(T pointer)
|
||||
{
|
||||
if(pointer == NULL)
|
||||
{
|
||||
std::string errormessage = "Pointer of type \"";
|
||||
errormessage+=typeid(pointer).name();
|
||||
errormessage+="\" was not correctly created.";
|
||||
throw std::runtime_error(errormessage);
|
||||
}
|
||||
}
|
||||
|
||||
class MainFrame;
|
||||
|
||||
class wxvbamApp : public wxApp
|
||||
|
|
Loading…
Reference in New Issue