Skip to content

Commit 075c689

Browse files
committed
CellularConnectionHandler: Generate runtime error if getUDP() is called
__attribute__((error)) not working on virtual functions
1 parent 3ac5c05 commit 075c689

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Diff for: src/Arduino_CellularConnectionHandler.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ unsigned long CellularConnectionHandler::getTime()
4040
return _cellular.getCellularTime().getUNIXTimestamp();
4141
}
4242

43+
UDP & CellularConnectionHandler::getUDP()
44+
{
45+
Debug.print(DBG_ERROR, F("CellularConnectionHandler has no UDP support"));
46+
while(1) {};
47+
}
48+
4349
/******************************************************************************
4450
PROTECTED MEMBER FUNCTIONS
4551
******************************************************************************/

Diff for: src/Arduino_CellularConnectionHandler.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
#include "Arduino_ConnectionHandler.h"
2020

21-
2221
#ifdef BOARD_HAS_CELLULAR /* Only compile if the board has Cellular */
2322

2423
/******************************************************************************
@@ -34,7 +33,7 @@ class CellularConnectionHandler : public ConnectionHandler
3433

3534
virtual unsigned long getTime() override;
3635
virtual Client & getClient() override { return _gsm_client; };
37-
virtual UDP & getUDP() override { } __attribute__((error("CellularConnectionHandler has no UDP support")));
36+
virtual UDP & getUDP() override;
3837

3938

4039
protected:

0 commit comments

Comments
 (0)