Al posto di "if(as==null)" hai provato ad usare "for(;"?