Fix passing null to memcpy

/home/elsid/dev/openmw/components/detournavigator/navmeshtilescache.cpp:36:24: runtime error: null pointer passed as argument 2, which is declared to never be null
    #0 0x55e37ba4cda5 in makeNavMeshKey /home/elsid/dev/openmw/components/detournavigator/navmeshtilescache.cpp:36
    #1 0x55e37ba4cda5 in DetourNavigator::NavMeshTilesCache::set(osg::Vec3f const&, osg::Vec2i const&, DetourNavigator::RecastMesh const&, std::vector<DetourNavigator::OffMeshConnection, std::allocator<DetourNavigator::OffMeshConnection> > const&, DetourNavigator::NavMeshData&&) /home/elsid/dev/openmw/components/detournavigator/navmeshtilescache.cpp:81
    #2 0x55e37fe3c861 in DetourNavigator::updateNavMesh(osg::Vec3f const&, DetourNavigator::RecastMesh const*, osg::Vec2i const&, osg::Vec2i const&, std::vector<DetourNavigator::OffMeshConnection, std::allocator<DetourNavigator::OffMeshConnection> > const&, DetourNavigator::Settings const&, std::shared_ptr<Misc::ScopeGuarded<DetourNavigator::NavMeshCacheItem> > const&, DetourNavigator::NavMeshTilesCache&) /home/elsid/dev/openmw/components/detournavigator/makenavmesh.cpp:582
    #3 0x55e37fb796ce in DetourNavigator::AsyncNavMeshUpdater::processJob(DetourNavigator::AsyncNavMeshUpdater::Job const&) /home/elsid/dev/openmw/components/detournavigator/asyncnavmeshupdater.cpp:178
    #4 0x55e37fb9a125 in DetourNavigator::AsyncNavMeshUpdater::process() /home/elsid/dev/openmw/components/detournavigator/asyncnavmeshupdater.cpp:144
    #5 0x7f013f585c23 in execute_native_thread_routine /build/gcc/src/gcc/libstdc++-v3/src/c++11/thread.cc:80
    #6 0x7f013f8c63e8 in start_thread (/usr/lib/libpthread.so.0+0x93e8)
    #7 0x7f013e91d292 in __GI___clone (/usr/lib/libc.so.6+0x100292)
cherry-pick-c431f31c
elsid 4 years ago
parent 7b54415c40
commit d2d8a7a940
No known key found for this signature in database
GPG Key ID: B845CB9FEE18AB40

@ -21,18 +21,31 @@ namespace DetourNavigator
std::vector<unsigned char> result(indicesSize + verticesSize + areaTypesSize + waterSize + offMeshConnectionsSize);
unsigned char* dst = result.data();
if (indicesSize > 0)
{
std::memcpy(dst, recastMesh.getIndices().data(), indicesSize);
dst += indicesSize;
}
if (verticesSize > 0)
{
std::memcpy(dst, recastMesh.getVertices().data(), verticesSize);
dst += verticesSize;
}
if (areaTypesSize > 0)
{
std::memcpy(dst, recastMesh.getAreaTypes().data(), areaTypesSize);
dst += areaTypesSize;
}
if (waterSize > 0)
{
std::memcpy(dst, recastMesh.getWater().data(), waterSize);
dst += waterSize;
}
if (offMeshConnectionsSize > 0)
std::memcpy(dst, offMeshConnections.data(), offMeshConnectionsSize);
return result;

Loading…
Cancel
Save