package me.ykrank.s1next.viewmodel;

import android.databinding.ObservableField;
import android.net.Uri;
import android.view.View;

import me.ykrank.s1next.data.api.model.Note;
import me.ykrank.s1next.view.activity.PostListGatewayActivity;


public final class NoteViewModel {

    public final ObservableField<Note> data = new ObservableField<>();

    public View.OnClickListener clickNote() {
        return v -> {
            PostListGatewayActivity.start(v.getContext(), Uri.parse(data.get().getUrl()));
        };
    }
}

package me.ykrank.s1next.viewmodel;

import android.databinding.ObservableField;
import android.net.Uri;
import android.text.TextUtils;
import android.view.View;

import me.ykrank.s1next.data.api.model.Note;
import me.ykrank.s1next.view.activity.PostListGatewayActivity;


public final class NoteViewModel {

    public final ObservableField<Note> data = new ObservableField<>();

    public View.OnClickListener clickNote() {
        return v -> {
            String url = data.get().getUrl();
            if (!TextUtils.isEmpty(url)) {
                PostListGatewayActivity.start(v.getContext(), Uri.parse(url));
            }
        };
    }
}

Fix one null exception