[Spice-devel] [spice-gtk v1 4/6] channel-main: remove redundant if on SpiceSession creation

Victor Toso victortoso at redhat.com
Tue Sep 24 09:15:00 UTC 2019


From: Victor Toso <me at victortoso.com>

As spice_session_set_migration_session() does check with
SPICE_IS_SESSION() and would log a critical in case it is NULL, which
is better than just silent fail migration

Signed-off-by: Victor Toso <victortoso at redhat.com>
---
 src/channel-main.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/channel-main.c b/src/channel-main.c
index a0ab520..3fe8d64 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -2359,10 +2359,9 @@ static void main_migrate_connect(SpiceChannel *channel,
     CHANNEL_DEBUG(channel, "migrate connect");
     session = spice_channel_get_session(channel);
     mig.session = spice_session_new_from_session(session);
-    if (mig.session == NULL)
-        goto end;
-    if (!spice_session_set_migration_session(session, mig.session))
+    if (!spice_session_set_migration_session(session, mig.session)) {
         goto end;
+    }
 
     main_priv->migrate_data = &mig;
 
-- 
2.21.0



More information about the Spice-devel mailing list