Ideally you'd want to aviod DIV/0 errors, this can be overcome by using IF with ISERROR or you can use IF with DENOMINATOR

Otherwise you could use a simple IF statement

=IF(SUM(A1:A100)=0,0,AVERAGE(A1:A100))

Where A1:A100 is the range you want to average.