From 3bea0790e23811d9139f5b39e9b126445fee061c Mon Sep 17 00:00:00 2001
From: Dima Zavin <dima@android.com>
Date: Fri, 26 Aug 2011 13:59:18 -0700
Subject: [PATCH] init: check for list empty when getting commands for action

Change-Id: Id42d6a6b6297919b2e6520e074e31b5e01ae17bc
Signed-off-by: Dima Zavin <dima@android.com>
---
 init/init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/init/init.c b/init/init.c
index a1d6be104a..ef42e025cc 100755
--- a/init/init.c
+++ b/init/init.c
@@ -491,7 +491,7 @@ static struct command *get_first_command(struct action *act)
 {
     struct listnode *node;
     node = list_head(&act->commands);
-    if (!node)
+    if (!node || list_empty(&act->commands))
         return NULL;
 
     return node_to_item(node, struct command, clist);
-- 
GitLab