Browse Source

Fix lambda function for curl code errors

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Stefan Weil 1 year ago
parent
commit
4a00b68c63
1 changed files with 3 additions and 2 deletions
  1. 3
    2
      src/api/baseapi.cpp

+ 3
- 2
src/api/baseapi.cpp

@@ -1147,13 +1147,14 @@ bool TessBaseAPI::ProcessPagesInternal(const char* filename,
       fprintf(stderr, "Error, curl_easy_init failed\n");
       return false;
     } else {
-      CURLcode curlcode = curl_easy_setopt(curl, CURLOPT_URL, filename);
-      auto error = [curl, curlcode](const char* function) {
+      CURLcode curlcode;
+      auto error = [curl, &curlcode](const char* function) {
         fprintf(stderr, "Error, %s failed with error %s\n", function,
                 curl_easy_strerror(curlcode));
         curl_easy_cleanup(curl);
         return false;
       };
+      curlcode = curl_easy_setopt(curl, CURLOPT_URL, filename);
       if (curlcode != CURLE_OK) {
         return error("curl_easy_setopt");
       }