The class get_table_by_scope_result
is structured like this:
struct get_table_by_scope_result {
vector<get_table_by_scope_result_row> rows;
string more; ///< fill lower_bound with this value to fetch more rows
};
So if you want to access the count for a particular scope, then you are doing it the correct way by saying result.rows[0].count
, which will give you the number of rows in the first scope of the table.
I imagine the reason why you are getting an abort is because rows[0]
doesn't exist, and then you are trying to deference a null pointer.
So trying wrapping your code like this:
uint32_t count(0);
if(!result.rows.empty())
{
count = result.rows.at(0).count;
}
If you still get the error, then maybe post a bit more detail, and show or check that the stat
table exists with the correct scope and rows as expected using something like cleos get table