Skip to content

KML GroundOverlay without Icon crashes when rendered through DataLayer #1870

Backlog

Description

@kikoso

Summary

A KML <GroundOverlay> without <Icon> crashes when the KML is rendered through the new DataLayer path (DataLayerLoader or Kml.toLayer()). MapViewRenderer adds the overlay without any image, and the Maps SDK does not accept it.

Expected behavior

The overlay is skipped (or added hidden with the transparent placeholder, as we do already while an icon is loading), and the rest of the KML renders.

Observed behavior

KmlMapper maps the missing href to iconUrl = null, so MapViewRenderer goes into the "No iconUrl, add directly" branch and calls addGroundOverlay(options) without image(...):

} ?: run {
// No iconUrl, add directly
val mapOverlay = groundOverlayCollection?.addGroundOverlay(options) ?: map.addGroundOverlay(options)
if (mapOverlay != null) {
mapObjects.add(mapOverlay)
}

I tried addGroundOverlay with options without image on a Pixel 4 and the SDK throws:

java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.android.gms.dynamic.IObjectWrapper com.google.android.gms.maps.model.BitmapDescriptor.zza()' on a null object reference

The legacy KmlLayer is not affected: it maps the missing href to "", so it falls in the placeholder branch.

Environment details

  1. Pixel 4
  2. Android 13
  3. android-maps-utils main (7.0.1)

Steps to reproduce

  1. Load a KML like the one below with DataLayerLoader.loadInputStream(...) and render the resulting DataLayer on a map.
  2. The renderer reaches the branch linked above and the SDK throws when the ground overlay is added.

Code example

<kml xmlns="http://www.opengis.net/kml/2.2">
  <Document>
    <GroundOverlay>
      <name>Campus Overlay</name>
      <LatLonBox>
        <north>37.425</north>
        <south>37.420</south>
        <east>-122.080</east>
        <west>-122.088</west>
      </LatLonBox>
    </GroundOverlay>
  </Document>
</kml>

I found it while reviewing #1858: the test fixture there has the same shape, and it passes only because the fake map in the testing toolkit accepts options without image.

Activity

  1. added
    type: bug
    on Nov 25, 2026
  2. added
    priority: p0
    on Nov 25, 2026
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

    priority: p0type: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions