bugfix: An exception was thrown when converting empty strings to uint64
This commit is contained in:
parent
897e36dc44
commit
87a432f326
|
@ -335,6 +335,8 @@ public:
|
||||||
*/
|
*/
|
||||||
const std::vector<string> get_vector(const string &key) const;
|
const std::vector<string> get_vector(const string &key) const;
|
||||||
|
|
||||||
|
const std::uint_fast64_t stouint64(const string &str) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Json::Value _tree;
|
Json::Value _tree;
|
||||||
bool _valid;
|
bool _valid;
|
||||||
|
|
|
@ -75,7 +75,7 @@ const string Account::header_static() const
|
||||||
|
|
||||||
const std::uint_fast64_t Account::id() const
|
const std::uint_fast64_t Account::id() const
|
||||||
{
|
{
|
||||||
return std::stoull(get_string("id"));
|
return stouint64(get_string("id"));
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool Account::locked() const
|
const bool Account::locked() const
|
||||||
|
|
|
@ -103,7 +103,7 @@ const uint_fast64_t Attachment::height_small() const
|
||||||
|
|
||||||
const std::uint_fast64_t Attachment::id() const
|
const std::uint_fast64_t Attachment::id() const
|
||||||
{
|
{
|
||||||
return std::stoull(get_string("id"));
|
return stouint64(get_string("id"));
|
||||||
}
|
}
|
||||||
|
|
||||||
const string Attachment::preview_url() const
|
const string Attachment::preview_url() const
|
||||||
|
|
|
@ -31,7 +31,7 @@ List::List()
|
||||||
|
|
||||||
const uint_fast64_t List::id() const
|
const uint_fast64_t List::id() const
|
||||||
{
|
{
|
||||||
return std::stoull(get_string("id"));
|
return stouint64(get_string("id"));
|
||||||
}
|
}
|
||||||
|
|
||||||
const string List::title() const
|
const string List::title() const
|
||||||
|
|
|
@ -34,7 +34,7 @@ const string Mention::acct() const
|
||||||
|
|
||||||
const uint_fast64_t Mention::id() const
|
const uint_fast64_t Mention::id() const
|
||||||
{
|
{
|
||||||
return std::stoull(get_string("id"));
|
return stouint64(get_string("id"));
|
||||||
}
|
}
|
||||||
|
|
||||||
const string Mention::url() const
|
const string Mention::url() const
|
||||||
|
|
|
@ -47,7 +47,7 @@ const system_clock::time_point Notification::created_at() const
|
||||||
|
|
||||||
const uint_fast64_t Notification::id() const
|
const uint_fast64_t Notification::id() const
|
||||||
{
|
{
|
||||||
return std::stoull(get_string("id"));
|
return stouint64(get_string("id"));
|
||||||
}
|
}
|
||||||
|
|
||||||
const Easy::Status Notification::status() const
|
const Easy::Status Notification::status() const
|
||||||
|
|
|
@ -49,7 +49,7 @@ const bool Relationship::following() const
|
||||||
|
|
||||||
const uint_fast64_t Relationship::id() const
|
const uint_fast64_t Relationship::id() const
|
||||||
{
|
{
|
||||||
return std::stoull(get_string("id"));
|
return stouint64(get_string("id"));
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool Relationship::muting() const
|
const bool Relationship::muting() const
|
||||||
|
|
|
@ -34,6 +34,6 @@ const bool Report::action_taken() const
|
||||||
|
|
||||||
const uint_fast64_t Report::id() const
|
const uint_fast64_t Report::id() const
|
||||||
{
|
{
|
||||||
return std::stoull(get_string("id"));
|
return stouint64(get_string("id"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,17 +92,17 @@ const uint_fast64_t Status::favourites_count() const
|
||||||
|
|
||||||
const uint_fast64_t Status::id() const
|
const uint_fast64_t Status::id() const
|
||||||
{
|
{
|
||||||
return std::stoull(get_string("id"));
|
return stouint64(get_string("id"));
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint_fast64_t Status::in_reply_to_id() const
|
const uint_fast64_t Status::in_reply_to_id() const
|
||||||
{
|
{
|
||||||
return std::stoull(get_string("in_reply_to_id"));
|
return stouint64(get_string("in_reply_to_id"));
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint_fast64_t Status::in_reply_to_account_id() const
|
const uint_fast64_t Status::in_reply_to_account_id() const
|
||||||
{
|
{
|
||||||
return std::stoull(get_string("in_reply_to_account_id"));
|
return stouint64(get_string("in_reply_to_account_id"));
|
||||||
}
|
}
|
||||||
|
|
||||||
const string Status::language() const
|
const string Status::language() const
|
||||||
|
|
|
@ -221,3 +221,15 @@ const std::vector<string> Easy::Entity::get_vector(const string &key) const
|
||||||
_was_set = false;
|
_was_set = false;
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::uint_fast64_t Easy::Entity::stouint64(const string &str) const
|
||||||
|
{
|
||||||
|
if (str == "")
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return stoull(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Reference in New Issue