]> git.saurik.com Git - wxWidgets.git/commitdiff
Added some safety checks
authorGuillermo Rodriguez Garcia <guille@iies.es>
Tue, 29 Feb 2000 21:02:16 +0000 (21:02 +0000)
committerGuillermo Rodriguez Garcia <guille@iies.es>
Tue, 29 Feb 2000 21:02:16 +0000 (21:02 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6362 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/sockets/client.cpp

index 2240786c198749f99a7f076a9f2a404e755b046c..ab5d91ed38d18b80d527dae01ceae1eecf00a9c4 100644 (file)
@@ -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"));