posix: PATCH: Check delay_before_tx/rx for None in serialposix.py, fixes #126
diff --git a/CHANGES.rst b/CHANGES.rst
index cf4f6ce..25bf49e 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -634,3 +634,7 @@
 Bugfixes:
 
 - [#122] fix bug in FramedPacket
+
+Bugfixes (posix):
+
+- [#126] PATCH: Check delay_before_tx/rx for None in serialposix.py
diff --git a/serial/serialposix.py b/serial/serialposix.py
index bc2468c..0bf3df5 100644
--- a/serial/serialposix.py
+++ b/serial/serialposix.py
@@ -139,8 +139,10 @@
                         buf[0] |= SER_RS485_RTS_AFTER_SEND
                     else:
                         buf[0] &= ~SER_RS485_RTS_AFTER_SEND
-                    buf[1] = int(rs485_settings.delay_before_tx * 1000)
-                    buf[2] = int(rs485_settings.delay_before_rx * 1000)
+                    if rs485_settings.delay_before_tx is not None:
+                        buf[1] = int(rs485_settings.delay_before_tx * 1000)
+                    if rs485_settings.delay_before_rx is not None:
+                        buf[2] = int(rs485_settings.delay_before_rx * 1000)
                 else:
                     buf[0] = 0  # clear SER_RS485_ENABLED
                 fcntl.ioctl(self.fd, TIOCSRS485, buf)