driver-hidpp10: fix segfault when committing unnamed profiles

This commit is contained in:
peelz
2020-08-19 00:52:00 -04:00
committed by Filipe Laíns
parent 20b573668e
commit 920bc2b993

View File

@@ -573,7 +573,8 @@ hidpp10drv_commit(struct ratbag_device *device)
return rc;
p.enabled = profile->is_enabled;
strncpy_safe((char*)p.name, profile->name, 24);
if (profile->name != NULL)
strncpy_safe((char*)p.name, profile->name, 24);
ratbag_profile_for_each_resolution(profile, resolution) {
p.dpi_modes[resolution->index].xres = resolution->dpi_x;