hantek-6xxx: fix potential NULL dereference

Check pointers' validity before dereferencing.

This was reported by clang's scan-build.
This commit is contained in:
Gerhard Sittig 2018-02-09 19:03:06 +01:00 committed by Uwe Hermann
parent b0e80e9aa9
commit e93ca8a4d6
1 changed files with 2 additions and 0 deletions

View File

@ -460,6 +460,8 @@ static int config_list(uint32_t key, GVariant **data,
*data = std_gvar_array_u32(ARRAY_AND_SIZE(devopts_cg));
break;
case SR_CONF_COUPLING:
if (!devc)
return SR_ERR_ARG;
*data = g_variant_new_strv(devc->coupling_vals, devc->coupling_tab_size);
break;
case SR_CONF_VDIV: