Check for NULL context in Look ahead queue APIs

Added checks for NULL context passed to lookahead
functions.

Change-Id: If4b914fa117e4819e023634e202768636a0f2834
diff --git a/av1/encoder/lookahead.c b/av1/encoder/lookahead.c
index 5a995b0..4dd7318 100644
--- a/av1/encoder/lookahead.c
+++ b/av1/encoder/lookahead.c
@@ -201,6 +201,9 @@
                                            int index) {
   struct lookahead_entry *buf = NULL;
 
+  if (ctx == NULL) {
+    return buf;
+  }
   if (index >= 0) {
     // Forward peek
     if (index < ctx->sz) {
@@ -220,4 +223,7 @@
   return buf;
 }
 
-unsigned int av1_lookahead_depth(struct lookahead_ctx *ctx) { return ctx->sz; }
+unsigned int av1_lookahead_depth(struct lookahead_ctx *ctx) {
+  assert(ctx != NULL);
+  return ctx->sz;
+}