Manage empty item in item_list theme Imagine this simple

 $items = array(
   'string',
   'string2',
   $extra_items,
 );


And theme a block content like

 $content = array(
   'subject'   =&gt; t('Block title'),
   'content'   =&gt; array(
     '#theme'  =&gt; 'item_list',
     '#items'  =&gt; $items,
     '#attributes' =&gt; array('class' =&gt; 'my-UL'),
   ),
 );


$extra_items is getting values from a custom hook that may be empty!In that case
theme_item_list() brings an empty &lt;li&gt;&lt;/li&gt; for that item that is NULL

How can i ensure that this &lt;li&gt;&lt;/li&gt; is displayed only when this item has a value?
You simply need to run array_filter on $items - this will remove the empty entries. 

Whether this should be handled by theme_item_list or not is debatable. It doesn't make semantic sense to theme empty list items - however in most cases the filtering would not be necessary, so from a performance point of view it doesn't make sense for theme_item_list to do it.