Skip to content

NPE in ComputedCSSStyleDeclaration.getLeft #488

Description

@gaellalire
Caused by: java.lang.NullPointerException: null
	at com.gargoylesoftware.htmlunit.javascript.host.css.ComputedCSSStyleDeclaration.getLeft(ComputedCSSStyleDeclaration.java:1580)
	at com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement.getOffsetLeft(HTMLElement.java:1393)

Issue is still there in 2.62.0.

I tested if parent is null to workaround the issue, worked for me but maybe not the best fix.

			final HTMLElement parent = (HTMLElement) getElement().getParentElement();
			if (parent != null) {
				final ComputedCSSStyleDeclaration style = parent.getWindow().getComputedStyle(parent, null);
				left = pixelValue(style.getLeftWithInheritance());
			} else {
				left = 0;
			}

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions