Browse code

avio: make avio_close(NULL) a no-op

Its behaviour in line with ffurl_close(NULL).

Luca Barbato authored on 2012/04/28 02:53:04
Showing 1 changed files
... ...
@@ -756,8 +756,12 @@ int avio_open2(AVIOContext **s, const char *filename, int flags,
756 756
 
757 757
 int avio_close(AVIOContext *s)
758 758
 {
759
-    URLContext *h = s->opaque;
759
+    URLContext *h;
760
+
761
+    if (!s)
762
+        return 0;
760 763
 
764
+    h = s->opaque;
761 765
     av_free(s->buffer);
762 766
     av_free(s);
763 767
     return ffurl_close(h);