From 6f505cae8268c4b56ce1bf3ddb5b21efc422f1c3 Mon Sep 17 00:00:00 2001 From: Guillermo Rodriguez Garcia Date: Tue, 29 Feb 2000 21:02:16 +0000 Subject: [PATCH] Added some safety checks git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6362 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/sockets/client.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/samples/sockets/client.cpp b/samples/sockets/client.cpp index 2240786c19..ab5d91ed38 100644 --- a/samples/sockets/client.cpp +++ b/samples/sockets/client.cpp @@ -533,6 +533,12 @@ void MyFrame::OnTestURL(wxCommandEvent& WXUNUSED(event)) // Parse the URL wxURL url(urlname); + if (url.GetError() != wxURL_NOERR) + { + m_text->AppendText(_("Error: couldn't parse URL\n")); + m_text->AppendText(_("=== URL test ends ===\n")); + return; + } // Try to get the input stream (connects to the given URL) m_text->AppendText(_("Trying to establish connection...\n")); @@ -557,6 +563,13 @@ void MyFrame::OnTestURL(wxCommandEvent& WXUNUSED(event)) // Get the data wxFileOutputStream sout(wxString("test.url")); + if (!sout.Ok()) + { + m_text->AppendText(_("Error: couldn't open file for output\n")); + m_text->AppendText(_("=== URL test ends ===\n")); + return; + } + data->Read(sout); m_text->AppendText(_("Results written to file: test.url\n")); m_text->AppendText(_("Done.\n")); -- 2.47.2