int i;
        struct pipe_ctx *otg_master = resource_get_otg_master_for_stream(
                        &new_ctx->res_ctx, stream);
-       int cur_slice_count = resource_get_odm_slice_count(otg_master);
+       int cur_slice_count;
        bool result = true;
 
+       if (!otg_master)
+               return false;
+
+       cur_slice_count = resource_get_odm_slice_count(otg_master);
+
        if (new_slice_count == cur_slice_count)
                return result;
 
 
                stream = context->streams[i];
                otg_master = resource_get_otg_master_for_stream(
                                &context->res_ctx, stream);
+               if (!otg_master)
+                       continue;
+
                count = resource_get_odm_slice_count(otg_master);
                update_slice_table_for_stream(table, stream, count);
 
 
        } else {
                /* stream was configured with dummy plane, so get pipes from opp head */
                struct pipe_ctx *otg_master_pipe = dml_ctx->config.callbacks.get_otg_master_for_stream(&context->res_ctx, dc_main_stream);
-               num_pipes = dml_ctx->config.callbacks.get_opp_heads_for_otg_master(otg_master_pipe, &context->res_ctx, dc_main_pipes);
+               if (otg_master_pipe != NULL)
+                       num_pipes = dml_ctx->config.callbacks.get_opp_heads_for_otg_master(otg_master_pipe, &context->res_ctx, dc_main_pipes);
        }
 
        /* if phantom exists, find associated pipes */
 
 {
        struct pipe_ctx *otg_master = ctx->config.callbacks.get_otg_master_for_stream(&state->res_ctx, stream);
 
+       if (!otg_master)
+               return 0;
+
        return ctx->config.callbacks.get_odm_slice_count(otg_master);
 }