Andrew Boyson / net

Dependents:   oldheating gps motorhome heating

Files at this revision

API Documentation at this revision

Comitter:
andrewboyson
Date:
Fri Apr 23 10:33:21 2021 +0000
Parent:
195:bd5b123143ca
Child:
197:465f5f2154b7
Commit message:
Corrected error where UserPollForData function pointer was not checked for NULL before being used. It was causing the program to crash when not used.

Changed in this revision

udp/udp.c Show annotated file Show diff for this revision Revisions of this file
--- a/udp/udp.c	Sun Apr 18 19:04:48 2021 +0000
+++ b/udp/udp.c	Fri Apr 23 10:33:21 2021 +0000
@@ -190,13 +190,16 @@
             dstPort = TFTP_SERVER_PORT;
         }
     }
-    if (!action)
+    if (UserPollForUdpPacketToSend)
     {
-        action = UserPollForUdpPacketToSend(type, pDataLength, pData);
-        if (action)
+        if (!action)
         {
-            srcPort = UserUdpDstPort;
-            dstPort = UserUdpSrcPort;
+            action = UserPollForUdpPacketToSend(type, pDataLength, pData);
+            if (action)
+            {
+                srcPort = UserUdpDstPort;
+                dstPort = UserUdpSrcPort;
+            }
         }
     }