From bfe3afbc62ae65e79ffac64f12a2ce2e884388d2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C3=ABl=20Van=20Canneyt?= <michael@freepascal.org>
Date: Tue, 28 Sep 2021 10:14:18 +0200
Subject: [PATCH]  * Add error check

---
 packages/libcurl/examples/teststream.pp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/packages/libcurl/examples/teststream.pp b/packages/libcurl/examples/teststream.pp
index e3f797317a..0af7ca0bf7 100644
--- a/packages/libcurl/examples/teststream.pp
+++ b/packages/libcurl/examples/teststream.pp
@@ -44,7 +44,8 @@ begin
       curl_easy_setopt(hCurl,CURLOPT_URL,[URL]);
       curl_easy_setopt(hCurl,CURLOPT_WRITEFUNCTION,[@DoWrite]);
       curl_easy_setopt(hCurl,CURLOPT_WRITEDATA,[Pointer(F)]);
-      curl_easy_perform(hCurl);
+      if curl_easy_perform(hCurl)<>CURLE_OK then
+        Writeln(StdErr,'Failed to get URL');
       curl_easy_cleanup(hCurl);
       end;
   Finally