Merge pull request #380 from basanets/master

Fixed the segfault which can happen after address.option("connectionOrder") return nullptr
This commit is contained in:
Emiel Bruijntjes 2020-11-16 20:07:22 +01:00 committed by GitHub
commit b05c06b226
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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;
}