google / earthenterprise

Google Earth Enterprise - Open Source
Apache License 2.0
2.66k stars 882 forks source link

Possible null pointer dereference in earth_enterprise/src/fusion/fusionui/AssetChooser.cpp:431 #1954

Closed tst-jlarocco closed 3 years ago

tst-jlarocco commented 3 years ago

Describe the bug In this code block, asseItem should not be accessed until after the NULL check.

      AssetItem* assetItem = dynamic_cast<AssetItem*>(item);
      std::string san = shortAssetName(assetItem->getAssetHandle()->getName().toStdString().c_str());
      if (assetItem != NULL &&
          getName() != san.c_str()) {
        iconView->clearSelection();
      }

Additional context

Found by cppcheck.