OSDN Git Service

OggInputStream, fixed crash (index == -1).
authornathan.sweet <nathan.sweet@6c4fd544-2939-11df-bb46-9574ba5d0bfa>
Fri, 17 Feb 2012 17:33:56 +0000 (17:33 +0000)
committernathan.sweet <nathan.sweet@6c4fd544-2939-11df-bb46-9574ba5d0bfa>
Fri, 17 Feb 2012 17:33:56 +0000 (17:33 +0000)
backends/gdx-openal/src/com/badlogic/gdx/backends/openal/OggInputStream.java

index 30c135d..62b5c6e 100644 (file)
@@ -144,6 +144,7 @@ public class OggInputStream extends InputStream {
 \r
                // submit a 4k block to libvorbis' Ogg layer\r
                int index = syncState.buffer(4096);\r
+               if (index == -1) return false;\r
 \r
                buffer = syncState.data;\r
                if (buffer == null) {\r
@@ -234,6 +235,7 @@ public class OggInputStream extends InputStream {
                        }\r
                        // no harm in not checking before adding more\r
                        index = syncState.buffer(4096);\r
+                       if (index == -1) return false;\r
                        buffer = syncState.data;\r
                        try {\r
                                bytes = input.read(buffer, index, 4096);\r