]> ToastFreeware Gitweb - gregoa/bti.git/blobdiff - bti.c
Fix a segfault when specifying an invalid host.
[gregoa/bti.git] / bti.c
diff --git a/bti.c b/bti.c
index 3938e0a86b6b04f8050f2fc91d0f2bf5ce15ee98..17a2a9396badba7f770002c67d99f842fa6e24c8 100644 (file)
--- a/bti.c
+++ b/bti.c
@@ -52,7 +52,7 @@
        } while (0)
 
 
-static int debug;
+int debug;
 
 static void display_help(void)
 {
@@ -284,8 +284,8 @@ static CURL *curl_init(void)
 }
 
 /* The final place data is sent to the screen/pty/tty */
-bti_output_line(struct session *session, xmlChar *user, xmlChar *id,
-               xmlChar *created, xmlChar *text)
+void bti_output_line(struct session *session, xmlChar *user, xmlChar *id,
+                    xmlChar *created, xmlChar *text)
 {
        if (session->verbose)
                printf("[%s] {%s} (%.16s) %s\n", user, id, created, text);
@@ -724,6 +724,11 @@ static int send_request(struct session *session)
                                free(req_url);
                }
 
+               if (!reply) {
+                       fprintf(stderr, "Error retrieving from URL (%s)\n", endpoint);
+                       return 1;
+               }
+
                if ((session->action != ACTION_UPDATE) &&
                                (session->action != ACTION_RETWEET))
                        parse_timeline(reply, session);