From: Václav Slavík Date: Sat, 11 Mar 2000 19:31:19 +0000 (+0000) Subject: some != NULL checks X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/f5ba273ecd799f652736ce2bc830283787302a56 some != NULL checks git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6627 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/html/helpfrm.cpp b/src/html/helpfrm.cpp index a2cc0a9803..b36d1c62e6 100644 --- a/src/html/helpfrm.cpp +++ b/src/html/helpfrm.cpp @@ -92,6 +92,7 @@ class wxHtmlHelpHashData : public wxObject public: wxHtmlHelpHashData(int index, wxTreeItemId id) : wxObject() { m_Index = index; m_Id = id;} + ~wxHtmlHelpHashData() {} int m_Index; wxTreeItemId m_Id; @@ -1147,7 +1148,10 @@ void wxHtmlHelpFrame::OnToolbar(wxCommandEvent& event) { if (m_Printer == NULL) m_Printer = new wxHtmlEasyPrinting(_("Help Printing"), this); - m_Printer -> PrintFile(m_HtmlWin -> GetOpenedPage()); + if (!m_HtmlWin -> GetOpenedPage()) + wxLogWarning(_("Cannot print empty page.")); + else + m_Printer -> PrintFile(m_HtmlWin -> GetOpenedPage()); } break; #endif diff --git a/src/html/htmprint.cpp b/src/html/htmprint.cpp index e552d63d80..ed299f645d 100644 --- a/src/html/htmprint.cpp +++ b/src/html/htmprint.cpp @@ -266,6 +266,13 @@ void wxHtmlPrintout::SetHtmlFile(const wxString& htmlfile) { wxFileSystem fs; wxFSFile *ff = fs.OpenFile(htmlfile); + + if (ff == NULL) + { + wxLogError(htmlfile + _(": file does not exist!")); + return; + } + wxInputStream *st = ff -> GetStream(); char *t = new char[st -> GetSize() + 1]; st -> Read(t, st -> GetSize());