IF there is no child in the particular parent, then it won't expand (because there is nothing to show).
If your question is how to hide the group indicator when there is no child present, then put the following snippet inside getGroupView()
:
if ( getChildrenCount( groupPosition ) == 0 ) {
indicator.setVisibility( View.INVISIBLE );
}
else {
indicator.setVisibility( View.VISIBLE );
indicator.setImageResource( isExpanded ? R.drawable.group_expanded : R.drawable.group_closed );
}