You can test if an array is empty using this function:
function empty(a, i) { for(i in a) return 0; return 1}
This function comes from comp.lang.awk see this post