[vte] lib: Check out params before setting them



commit a8924d88f23c37322bfc20f2ef08949c9c27d4cb
Author: Christian Persch <chpe gnome org>
Date:   Fri Nov 25 23:15:46 2016 +0100

    lib: Check out params before setting them
    
    They are allowed to be NULL, so only set them when non-NULL.

 src/pty.cc |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/pty.cc b/src/pty.cc
index 93f9a13..b87838c 100644
--- a/src/pty.cc
+++ b/src/pty.cc
@@ -1174,11 +1174,14 @@ vte_pty_spawn_finish(VtePty *pty,
 
         gpointer pidptr = g_task_propagate_pointer(G_TASK(result), error);
         if (pidptr == nullptr) {
-                *child_pid = -1;
+                if (child_pid)
+                        *child_pid = -1;
                 return FALSE;
         }
 
-        *child_pid = *(GPid*)pidptr;
-        *error = nullptr;
+        if (child_pid)
+                *child_pid = *(GPid*)pidptr;
+        if (error)
+                *error = nullptr;
         return TRUE;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]