Skip to content

Commit

Permalink
Strip trailing NULL bytes from WKT.
Browse files Browse the repository at this point in the history
Close #3332
  • Loading branch information
abellgithub committed Jan 13, 2021
1 parent d59be9b commit d31a4bc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion io/LasHeader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,10 @@ void LasHeader::setSrsFromWkt()
const char *c = vlr->data() + len - 1;
if (*c == 0)
len--;
m_srs.set(std::string(vlr->data(), len));
std::string wkt(vlr->data(), len);
// Strip any excess NULL bytes from the WKT.
wkt.erase(std::find(wkt.begin(), wkt.end(), '\0'), wkt.end());
m_srs.set(wkt);
}


Expand Down

0 comments on commit d31a4bc

Please sign in to comment.