#11019: Make BytesGenerator handle Message with None body.

Bug discovery and initial patch by Victor Stinner.
diff --git a/Lib/email/generator.py b/Lib/email/generator.py
index 9d33f1c..531fa9a 100644
--- a/Lib/email/generator.py
+++ b/Lib/email/generator.py
@@ -377,6 +377,8 @@
     def _handle_text(self, msg):
         # If the string has surrogates the original source was bytes, so
         # just write it back out.
+        if msg._payload is None:
+            return
         if _has_surrogates(msg._payload):
             self.write(msg._payload)
         else: