Added check if the connectionOrder receives nullptr and not a valid string. This can be a case if address.option(connectionOrder) returns nullptr.

This commit is contained in:
Mikhail Basanets 2020-11-16 19:56:28 +02:00
parent bca39d8f29
commit ced0de4eda
1 changed files with 2 additions and 1 deletions

View File

@ -50,7 +50,8 @@ public:
ConnectionOrder(const char *order) : _order(Order::standard)
{
// Set the orders based on the string
if (strcmp(order, "random") == 0) _order = Order::random;
if (order == nullptr) {} // first check if the order is not null
else if (strcmp(order, "random") == 0) _order = Order::random;
else if (strcmp(order, "ascending") == 0 || strcmp(order, "asc") == 0) _order = Order::ascending;
else if (strcmp(order, "descending") == 0 || strcmp(order, "desc") == 0 ) _order = Order::descending;
}