mirror of
https://github.com/Artikash/Example-Extension.git
synced 2024-11-10 11:35:35 +08:00
better error message
This commit is contained in:
parent
df609f6c1a
commit
1afad7165c
@ -15,11 +15,11 @@ struct InfoForExtension
|
|||||||
struct SentenceInfo
|
struct SentenceInfo
|
||||||
{
|
{
|
||||||
const InfoForExtension* infoArray;
|
const InfoForExtension* infoArray;
|
||||||
// nullptr marks end of info array
|
|
||||||
int64_t operator[](std::string propertyName)
|
int64_t operator[](std::string propertyName)
|
||||||
{
|
{
|
||||||
for (auto info = infoArray; info->name != nullptr; ++info) if (propertyName == info->name) return info->value;
|
for (auto info = infoArray; info->name; ++info) // nullptr name marks end of info array
|
||||||
throw;
|
if (propertyName == info->name) return info->value;
|
||||||
|
return *(int*)0xcccc = 0; // gives better error message than alternatives
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user