if (c != null) {
while (i < size) {
    public Signal fetchSignal() throws Exception {        Signal s = null;        Item mem = getChild(SystemItem.SIGNAL_MEMORY);        if (mem != null) {            Map c = mem.getChildren();            if (c != null) {                int index = 0;                int size = mem.getSize();                Signal child = null;                Integer priority = null;                Integer max = new Integer(0);                while (index < size) {                    child = (Signal) c.get(index);                    if (child != null) {                            priority = (Integer) child.getChild(Signal.PRIORITY);                            if (priority != null) {                                if (priority.isGreaterThan(max)) {                                    max = priority;                                s = child;                            }                        } else {                                throw new Exception("Could not fetch signal. The priority is null.");                        }                        } else {                            throw new Exception("Could not fetch signal. A child is null.");                    }                        index++;                }                if (s != null) {                    mem.removeChild(s.getName());                }            } else {                throw new Exception("Could not fetch signal. The children map is null.");            }        } else {            throw new Exception("Could not fetch signal. The signal memory is null.");        }        return s;    }