<commit_before>package cl.monsoon.s1next.widget;

import android.content.res.ColorStateList;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.StateListDrawable;
import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull;

public final class StateListDrawableWithTint extends StateListDrawable {

    private final ColorStateList mColorStateList;
    private final PorterDuff.Mode mMode;

    public StateListDrawableWithTint(@DrawableRes Drawable drawable, @NonNull ColorStateList colorStateList, @NonNull PorterDuff.Mode mode) {
        this.mColorStateList = colorStateList;
        this.mMode = mode;

        addState(new int[]{}, drawable);
    }

    @Override
    protected boolean onStateChange(int[] stateSet) {
        int color = mColorStateList.getColorForState(stateSet, Color.TRANSPARENT);
        setColorFilter(color, mMode);

        return super.onStateChange(stateSet);
    }
}<commit_msg>Fix NullPointerException due to aa05a2716a977f2ce442af61f538496e389ca1b6<commit_after>package cl.monsoon.s1next.widget;

import android.content.res.ColorStateList;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.StateListDrawable;
import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull;

public final class StateListDrawableWithTint extends StateListDrawable {

    private final ColorStateList mColorStateList;
    private final PorterDuff.Mode mMode;

    public StateListDrawableWithTint(@DrawableRes Drawable drawable, @NonNull ColorStateList colorStateList, @NonNull PorterDuff.Mode mode) {
        this.mColorStateList = colorStateList;
        this.mMode = mode;

        addState(new int[]{}, drawable);
    }

    @Override
    protected boolean onStateChange(int[] stateSet) {
        // mColorStateList is null when constructor invokes super() implicitly
        //noinspection ConstantConditions
        if (mColorStateList != null) {
            int color = mColorStateList.getColorForState(stateSet, Color.TRANSPARENT);
            setColorFilter(color, mMode);
        }

        return super.onStateChange(stateSet);
    }
}
{'fraction_non_alphanumeric': 0.07822685788787484, 'fraction_numerical': 0.012168622338113864, 'mean_word_length': 4.403755868544601, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '18538', 'n_tokens_mistral': 662, 'n_tokens_neox': 645, 'n_words': 137}