Improve error checking in several ctrl_get_* funcs

Improve error checking in several ctrl_get_*() functions. They all have
the following error-checking logic:
1. If the output parameter is a null pointer, return AOM_CODEC_INVALID_PARAM.
2. If ctx->frame_worker is a null pointer (i.e., the decoder is not
   initialized), return AOM_CODEC_ERROR.
3. Otherwise, return AOM_CODEC_OK.

The error-checking logic is realized in two ways to preserve the
original control structures in these functions.

To fix the crash in bug aomedia:2905, only the change to the
ctrl_get_last_quantizer() function is needed. I took the opportunity to
review the enture av1/av1_dx_iface.c file.

BUG=aomedia:2905
Change-Id: I66e48dd21fec1102567aad22608673945d5743c7
diff --git a/av1/av1_dx_iface.c b/av1/av1_dx_iface.c
index 888060c..21050cd 100644
--- a/av1/av1_dx_iface.c
+++ b/av1/av1_dx_iface.c
@@ -967,6 +967,7 @@
                                                va_list args) {
   int *const arg = va_arg(args, int *);
   if (arg == NULL) return AOM_CODEC_INVALID_PARAM;
+  if (ctx->frame_worker == NULL) return AOM_CODEC_ERROR;
   *arg = ((FrameWorkerData *)ctx->frame_worker->data1)
              ->pbi->common.quant_params.base_qindex;
   return AOM_CODEC_OK;
@@ -976,6 +977,7 @@
                                              va_list args) {
   int *const arg = va_arg(args, int *);
   if (arg == NULL) return AOM_CODEC_INVALID_PARAM;
+  if (ctx->frame_worker == NULL) return AOM_CODEC_ERROR;
   *arg = ((FrameWorkerData *)ctx->frame_worker->data1)->pbi->is_fwd_kf_present;
   return AOM_CODEC_OK;
 }
@@ -984,6 +986,7 @@
                                                va_list args) {
   int *const arg = va_arg(args, int *);
   if (arg == NULL) return AOM_CODEC_INVALID_PARAM;
+  if (ctx->frame_worker == NULL) return AOM_CODEC_ERROR;
   *arg =
       ((FrameWorkerData *)ctx->frame_worker->data1)->pbi->is_arf_frame_present;
   return AOM_CODEC_OK;
@@ -993,6 +996,7 @@
                                             va_list args) {
   int *const arg = va_arg(args, int *);
   if (arg == NULL) return AOM_CODEC_INVALID_PARAM;
+  if (ctx->frame_worker == NULL) return AOM_CODEC_ERROR;
   AV1Decoder *pbi = ((FrameWorkerData *)ctx->frame_worker->data1)->pbi;
   *arg = 0;
   switch (pbi->common.current_frame.frame_type) {
@@ -1096,7 +1100,7 @@
       return AOM_CODEC_ERROR;
     }
   }
-  return AOM_CODEC_OK;
+  return AOM_CODEC_INVALID_PARAM;
 }
 
 static aom_codec_err_t ctrl_get_sb_size(aom_codec_alg_priv_t *ctx,
@@ -1125,6 +1129,7 @@
     aom_codec_alg_priv_t *ctx, va_list args) {
   int *const arg = va_arg(args, int *);
   if (arg == NULL) return AOM_CODEC_INVALID_PARAM;
+  if (ctx->frame_worker == NULL) return AOM_CODEC_ERROR;
   *arg = ((FrameWorkerData *)ctx->frame_worker->data1)
              ->pbi->common.show_existing_frame;
   return AOM_CODEC_OK;
@@ -1147,7 +1152,7 @@
       return AOM_CODEC_ERROR;
     }
   }
-  return AOM_CODEC_OK;
+  return AOM_CODEC_INVALID_PARAM;
 }
 
 static aom_codec_err_t ctrl_get_frame_corrupted(aom_codec_alg_priv_t *ctx,
@@ -1207,6 +1212,7 @@
       frame_header_info->coded_tile_data_size = pbi->obu_size_hdr.size;
       frame_header_info->coded_tile_data = pbi->obu_size_hdr.data;
       frame_header_info->extra_size = pbi->frame_header_size;
+      return AOM_CODEC_OK;
     } else {
       return AOM_CODEC_ERROR;
     }
@@ -1433,17 +1439,25 @@
   (void)args;
   return AOM_CODEC_INCAPABLE;
 #else
-  if (ctx->frame_worker) {
-    AVxWorker *const worker = ctx->frame_worker;
-    FrameWorkerData *const frame_worker_data = (FrameWorkerData *)worker->data1;
-    AV1Decoder *pbi = frame_worker_data->pbi;
-    Accounting **acct = va_arg(args, Accounting **);
-    *acct = &pbi->accounting;
-    return AOM_CODEC_OK;
+  Accounting **acct = va_arg(args, Accounting **);
+
+  if (acct) {
+    if (ctx->frame_worker) {
+      AVxWorker *const worker = ctx->frame_worker;
+      FrameWorkerData *const frame_worker_data =
+          (FrameWorkerData *)worker->data1;
+      AV1Decoder *pbi = frame_worker_data->pbi;
+      *acct = &pbi->accounting;
+      return AOM_CODEC_OK;
+    } else {
+      return AOM_CODEC_ERROR;
+    }
   }
-  return AOM_CODEC_ERROR;
+
+  return AOM_CODEC_INVALID_PARAM;
 #endif
 }
+
 static aom_codec_err_t ctrl_set_decode_tile_row(aom_codec_alg_priv_t *ctx,
                                                 va_list args) {
   ctx->decode_tile_row = va_arg(args, int);