Skip to content

Commit

Permalink
better error message
Browse files Browse the repository at this point in the history
  • Loading branch information
Artikash committed Jun 29, 2019
1 parent df609f6 commit 1afad71
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ExampleExtension/Extension.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ struct InfoForExtension
struct SentenceInfo
{
const InfoForExtension* infoArray;
// nullptr marks end of info array
int64_t operator[](std::string propertyName)
{
for (auto info = infoArray; info->name != nullptr; ++info) if (propertyName == info->name) return info->value;
throw;
for (auto info = infoArray; info->name; ++info) // nullptr name marks end of info array
if (propertyName == info->name) return info->value;
return *(int*)0xcccc = 0; // gives better error message than alternatives
}
};

Expand Down

0 comments on commit 1afad71

Please sign in to comment.