ethtool: accept %NULL as argument for nm_ethtool_data_get_by_optname()/nm_ethtool_id_get_by_name()

Often it is useful to not accept %NULL as input argument, to catch bugs.
For simple functions like nm_ethtool_id_get_by_name(), such limitations
are more annoying than helpful. Gracefully accept %NULL and treat is
like an invalid ethtool option.
This commit is contained in:
Thomas Haller 2020-05-11 14:45:09 +02:00
parent 2027ff50af
commit 0d7d2425c4
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -196,7 +196,8 @@ nm_ethtool_data_get_by_optname (const char *optname)
{
gssize idx;
nm_assert (optname);
if (!optname)
return NULL;
_ASSERT_data ();