fromupstream: Fix "--replace" to keep the old BUG

The recent BUG cleanup broke "--replace" mode.  Now when you use
"--replace" you end up with a blank bug line.  Oops.  Let's fix.

The problem is that ''.split('\n') produces the list [''] or a 1 item
list containing the empty string.  In a boolean context that evaluates
to True to later tests in the code that were trying to check of
"bug_lines" was unset were failing.  Let's add a rule to the logic
where we keep bug_lines as the empty list if no bugs are specified.

BUG=None
TEST=Use "--replace"

Change-Id: I367108d618b5ce9a1c7d9221f42653391a89f326
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/dev-util/+/2674111
Tested-by: Douglas Anderson <dianders@chromium.org>
Auto-Submit: Douglas Anderson <dianders@chromium.org>
Commit-Queue: Tzung-Bi Shih <tzungbi@chromium.org>
Reviewed-by: Tzung-Bi Shih <tzungbi@chromium.org>
diff --git a/contrib/fromupstream.py b/contrib/fromupstream.py
index 3fd4a28..fa28e87 100755
--- a/contrib/fromupstream.py
+++ b/contrib/fromupstream.py
@@ -503,8 +503,11 @@
     bugs += ['chromium:%d' % x for x in args['crbug']]
     bugs = ', '.join(bugs)
     bugs = _remove_dup_bugs(bugs)
-    bug_lines = [x.strip(' ,') for x in
-                 _wrap_commit_line('BUG=', bugs).split('\n')]
+    if bugs:
+        bug_lines = [x.strip(' ,') for x in
+                     _wrap_commit_line('BUG=', bugs).split('\n')]
+    else:
+        bug_lines = []
 
     test_lines = [_wrap_commit_line('TEST=', x) for x in args['test']]