diff --git a/libdm/libdm-config.c b/libdm/libdm-config.c index 8fee4ecc7..3ece3d32a 100644 --- a/libdm/libdm-config.c +++ b/libdm/libdm-config.c @@ -170,8 +170,12 @@ void dm_config_destroy(struct dm_config_tree *cft) */ struct dm_config_tree *dm_config_remove_cascaded_tree(struct dm_config_tree *cft) { - struct dm_config_tree *second_cft = cft->cascade; + struct dm_config_tree *second_cft; + if (!cft) + return NULL; + + second_cft = cft->cascade; cft->cascade = NULL; return second_cft; diff --git a/test/t-000-basic.sh b/test/t-000-basic.sh index bd7ba693b..0b54d9524 100755 --- a/test/t-000-basic.sh +++ b/test/t-000-basic.sh @@ -23,3 +23,6 @@ diff -u actual expected # ensure we can create devices (uses dmsetup, etc) aux prepare_devs 5 +# ensure we do not crash on a bug in config file +aux lvmconf 'log/prefix = 1""' +not lvs