From fdda9af2c305ecf57407856b1d061c076ae8fe4a Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Wed, 18 Jan 2017 10:07:00 -0500 Subject: [PATCH] device-manager: handle NULL renderer better Right now we'll pass a NULL device name and crash if the renderer fails to open. This commit fixes that. --- src/libply-splash-core/ply-device-manager.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/libply-splash-core/ply-device-manager.c b/src/libply-splash-core/ply-device-manager.c index 4004e11..b4c33d4 100644 --- a/src/libply-splash-core/ply-device-manager.c +++ b/src/libply-splash-core/ply-device-manager.c @@ -689,16 +689,18 @@ create_devices_for_terminal_and_renderer_type (ply_device_manager_t *manager, return; } - old_renderer = ply_hashtable_lookup (manager->renderers, - (void *) ply_renderer_get_device_name (renderer)); + if (renderer != NULL) { + old_renderer = ply_hashtable_lookup (manager->renderers, + (void *) ply_renderer_get_device_name (renderer)); - if (old_renderer != NULL) { - ply_trace ("ignoring device %s since it's alerady managed", - ply_renderer_get_device_name (renderer)); - ply_renderer_free (renderer); + if (old_renderer != NULL) { + ply_trace ("ignoring device %s since it's alerady managed", + ply_renderer_get_device_name (renderer)); + ply_renderer_free (renderer); - renderer = NULL; - return; + renderer = NULL; + return; + } } } -- 2.11.0