]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
error handling a bit better
authorRudolf Polzer <divVerent@xonotic.org>
Wed, 17 Aug 2011 18:31:16 +0000 (20:31 +0200)
committerRudolf Polzer <divVerent@xonotic.org>
Wed, 17 Aug 2011 18:31:16 +0000 (20:31 +0200)
qcsrc/common/urllib.qc

index 83e00f119bfd8a0edb8955e1fde0992267a87962..934d1513013428eece084c2d991853d96a51773f 100644 (file)
@@ -84,9 +84,9 @@ void url_fopen(string url, float mode, entity pass, url_ready_func rdy)
                                if(e.url_wbuf < 0)
                                {
                                        print("buf_create: out of memory\n");
+                                       rdy(e, pass, URL_READY_ERROR);
                                        strunzone(e.url_url);
                                        remove(e);
-                                       rdy(world, pass, URL_READY_ERROR);
                                        return;
                                }
                                e.url_wbufpos = 0;
@@ -113,10 +113,9 @@ void url_fopen(string url, float mode, entity pass, url_ready_func rdy)
                                e.url_wbuf = -1;
                                if(!uri_get(url, i + MIN_URL_ID))
                                {
-                                       print("uri_get: failed\n");
+                                       rdy(e, pass, URL_READY_ERROR);
                                        strunzone(e.url_url);
                                        remove(e);
-                                       rdy(world, pass, URL_READY_ERROR);
                                        return;
                                }
                                e.url_ready = rdy;
@@ -161,8 +160,8 @@ void url_fclose(entity e, entity pass, url_ready_func rdy)
                                        break;
                        if(i >= NUM_URL_ID)
                        {
-                               rdy(e, pass, URL_READY_ERROR);
                                buf_del(e.url_wbuf);
+                               rdy(e, pass, URL_READY_ERROR);
                                strunzone(e.url_url);
                                remove(e);
                                return;
@@ -170,8 +169,8 @@ void url_fclose(entity e, entity pass, url_ready_func rdy)
 
                        if(!uri_postbuf(e.url_url, e.url_id + MIN_URL_ID, "text/plain", "\n", e.url_wbuf))
                        {
-                               rdy(e, pass, URL_READY_ERROR);
                                buf_del(e.url_wbuf);
+                               rdy(e, pass, URL_READY_ERROR);
                                strunzone(e.url_url);
                                remove(e);
                                return;