mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-31 00:46:36 +00:00
Fixes problem with dereferencing the end iterator for empty std::string objects
This commit is contained in:
committed by
Thomas Krijnen
parent
75040b6ffb
commit
01cfcebb09
@@ -317,7 +317,7 @@ IfcCharacterEncoder::operator std::string() {
|
|||||||
// Either 2 or 4 to uses \X2 or \X4 respectively.
|
// Either 2 or 4 to uses \X2 or \X4 respectively.
|
||||||
// Currently hardcoded to 4, but \X2 might be
|
// Currently hardcoded to 4, but \X2 might be
|
||||||
// sufficient for nearly all purposes.
|
// sufficient for nearly all purposes.
|
||||||
const int num_bytes = *std::max_element(str.begin(), str.end()) > 0xffff ? 4 : 2;
|
const int num_bytes = (str.empty() || *std::max_element(str.begin(), str.end())) > 0xffff ? 4 : 2;
|
||||||
const std::string num_bytes_str = std::string(1,num_bytes + 0x30);
|
const std::string num_bytes_str = std::string(1,num_bytes + 0x30);
|
||||||
|
|
||||||
bool in_extended = false;
|
bool in_extended = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user