nuplayer: handle error from MediaCodec in Decoder handleAnOutputBuffer

MediaCodec could send out message of output buffer available right before
it hits an error and clears its buffers.
Test: compiles
Author:    Shalaj Jain <shalajj@codeaurora.org>

Bug: 36075131
Change-Id: Ife308f3b8dc0448bcd1112b13cc0805bf7dedd7d
(cherry picked from commit 55f70d17df468db2b6691cbd7285a461e812eee4)
(cherry picked from commit 065e229f0744362c38bf71fc7e472c4d538a8227)
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp
index 4678956..b6a2360 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp
@@ -560,6 +560,11 @@
     sp<ABuffer> buffer;
     mCodec->getOutputBuffer(index, &buffer);
 
+    if (buffer == NULL) {
+        handleError(UNKNOWN_ERROR);
+        return false;
+    }
+
     if (index >= mOutputBuffers.size()) {
         for (size_t i = mOutputBuffers.size(); i <= index; ++i) {
             mOutputBuffers.add();