Skip to content

Commit

Permalink
Fix NPE in calcScale igreenwood#141
Browse files Browse the repository at this point in the history
  • Loading branch information
SorenaDev authored and shtolik committed Jul 9, 2021
1 parent bd12010 commit d3bf9c9
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -539,8 +539,10 @@ private void setupLayout(int viewW, int viewH) {
}

private float calcScale(int viewW, int viewH, float angle) {
mImgWidth = getDrawable().getIntrinsicWidth();
mImgHeight = getDrawable().getIntrinsicHeight();
if (getDrawable() != null) {
mImgWidth = getDrawable().getIntrinsicWidth();
mImgHeight = getDrawable().getIntrinsicHeight();
}
if (mImgWidth <= 0) mImgWidth = viewW;
if (mImgHeight <= 0) mImgHeight = viewH;
float viewRatio = (float) viewW / (float) viewH;
Expand Down

0 comments on commit d3bf9c9

Please sign in to comment.