Well, unless the party is fighting near the end of the corridor, they only have to be 25' away from where the fireball detonates to not be hit by it... So, actually, it's pretty easy to cast in a hallway and not get party members, unless the party doesn't work together well.