Skip to content

Commit

Permalink
nullcheck
Browse files Browse the repository at this point in the history
prevent NPE (#556)
  • Loading branch information
forrestguice committed Feb 13, 2022
1 parent 50d663c commit 462053e
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1941,15 +1941,14 @@ public boolean onMoonHeaderLongClick(CardAdapter adapter, int position) {

@Override
public void onLightmapClick(CardAdapter adapter, int position) {
if (Math.abs(CardAdapter.TODAY_POSITION - position) > 1) {
showSunPositionAt(adapter.initData(SuntimesActivity.this, position).first.dataNoon.calendar().getTimeInMillis());
Pair<SuntimesRiseSetDataset, SuntimesMoonData> cardData = adapter.initData(SuntimesActivity.this, position);
if (Math.abs(CardAdapter.TODAY_POSITION - position) > 1 && cardData != null) {
showSunPositionAt(cardData.first.dataNoon.calendar().getTimeInMillis());
} else showLightMapDialog();
}
@Override
public boolean onLightmapLongClick(CardAdapter adapter, int position) {
if (Math.abs(CardAdapter.TODAY_POSITION - position) > 1) {
showSunPositionAt(adapter.initData(SuntimesActivity.this, position).first.dataNoon.calendar().getTimeInMillis());
} else showLightMapDialog();
onLightmapClick(adapter, position);
return true;
}

Expand Down

0 comments on commit 462053e

Please sign in to comment.