Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 917ed5e7 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix a NPE from incorrect assumption of operation pecedence."

parents 374495a8 b617f84b
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -128,8 +128,10 @@ public class LegacySuggestionContextualCardController implements ContextualCardC
                return;
                return;
            }
            }
            final List<Suggestion> suggestions = mSuggestionController.getSuggestions();
            final List<Suggestion> suggestions = mSuggestionController.getSuggestions();
            Log.d(TAG, "Loaded suggests: "
            final String suggestionCount = suggestions == null
                    + suggestions == null ? "null" : String.valueOf(suggestions.size()));
                    ? "null"
                    : String.valueOf(suggestions.size());
            Log.d(TAG, "Loaded suggests: " + suggestionCount);


            final List<ContextualCard> cards = new ArrayList<>();
            final List<ContextualCard> cards = new ArrayList<>();
            if (suggestions != null) {
            if (suggestions != null) {
+3 −0
Original line number Original line Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.settings.homepage.contextualcards.legacysuggestion;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertThat;


import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;


import android.content.Context;
import android.content.Context;


@@ -84,8 +85,10 @@ public class LegacySuggestionContextualCardControllerTest {


    @Test
    @Test
    public void onServiceConnected_shouldLoadSuggestion() {
    public void onServiceConnected_shouldLoadSuggestion() {
        when(mSuggestionController.getSuggestions()).thenReturn(null);
        mController.mSuggestionController = mSuggestionController;
        mController.mSuggestionController = mSuggestionController;
        mController.setCardUpdateListener(mCardUpdateListener);
        mController.setCardUpdateListener(mCardUpdateListener);

        mController.onServiceConnected();
        mController.onServiceConnected();


        verify(mSuggestionController).getSuggestions();
        verify(mSuggestionController).getSuggestions();