Skip to content
This repository has been archived by the owner on Dec 5, 2017. It is now read-only.

Fix NullPointerExceptopn when getParent is null in applyToolTipPosition() #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lib/src/main/java/com/nhaarman/supertooltips/ToolTipView.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ public boolean onPreDraw() {
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) getLayoutParams();
layoutParams.width = mWidth;
setLayoutParams(layoutParams);

if (getParent() == null) {
return false;
}
if (mToolTip != null) {
applyToolTipPosition();
}
Expand Down Expand Up @@ -152,7 +154,9 @@ private void applyToolTipPosition() {
mView.getWindowVisibleDisplayFrame(viewDisplayFrame);

final int[] parentViewScreenPosition = new int[2];
((View) getParent()).getLocationOnScreen(parentViewScreenPosition);
if (getParent() != null) {
((View) getParent()).getLocationOnScreen(parentViewScreenPosition);
}

final int masterViewWidth = mView.getWidth();
final int masterViewHeight = mView.getHeight();
Expand Down