Fix for failures due to null trees

Previous fix was inadvertently removed due to a rebase issue.

BUG=aomedia:463

Change-Id: I607737ee64c35e679b19d3df97bb1b4ee47de268
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 5c69d9f..211025a 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -8749,10 +8749,10 @@
     best_mv[0].as_int = cur_mv[0].as_int;
     best_mv[1].as_int = cur_mv[1].as_int;
     memset(&best_compound_data, 0, sizeof(INTERINTER_COMPOUND_DATA));
-    av1_cost_tokens(compound_type_cost, cm->fc->compound_type_prob[bsize],
-                    av1_compound_type_tree);
 
     if (masked_compound_used) {
+      av1_cost_tokens(compound_type_cost, cm->fc->compound_type_prob[bsize],
+                      av1_compound_type_tree);
       // get inter predictors to use for masked compound modes
       av1_build_inter_predictors_for_planes_single_buf(
           xd, bsize, 0, 0, mi_row, mi_col, 0, preds0, strides);