pw_build: Fix ProjectBuilder recipe percentage

A divide by zero exception was being thrown for bazel builds due to
output containing '[0 / 0]'.

Change-Id: Ic7766e8f8a164c7d4999a3adb39e253c9abad3e7
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/194392
Commit-Queue: Auto-Submit <auto-submit@pigweed-service-accounts.iam.gserviceaccount.com>
Pigweed-Auto-Submit: Anthony DiGirolamo <tonymd@google.com>
Reviewed-by: Armando Montanez <amontanez@google.com>
diff --git a/pw_build/py/pw_build/project_builder.py b/pw_build/py/pw_build/project_builder.py
index d90777c..fcd09a6 100644
--- a/pw_build/py/pw_build/project_builder.py
+++ b/pw_build/py/pw_build/project_builder.py
@@ -276,12 +276,14 @@
                 failure_line = False
                 matches = line_match_result.groupdict()
                 recipe.status.current_step = line_match_result.group(0)
+                recipe.status.percent = 0.0
                 # Remove commas from step and total_steps strings
                 step = int(matches.get('step', '0').replace(',', ''))
                 total_steps = int(
                     matches.get('total_steps', '1').replace(',', '')
                 )
-                recipe.status.percent = float(step / total_steps)
+                if total_steps > 0:
+                    recipe.status.percent = float(step / total_steps)
 
             logger_method = logger.info
             if starting_failure_regex.match(output):