Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManuel Coenen <manuel@duet3d.com>2021-01-20 13:52:09 +0300
committerManuel Coenen <manuel@duet3d.com>2021-01-20 13:52:09 +0300
commite0f70c42bc156339d3018b1c6eff03a532266c5a (patch)
tree0d4a75fd922d59136e2efbab9364157eb965627a /src/Duet3_V06
parente875fc3c25056b8afeb815b4012c24b347c228b1 (diff)
Fix nullptr access in LookupPinName
Diffstat (limited to 'src/Duet3_V06')
-rw-r--r--src/Duet3_V06/Pins_Duet3_V06.cpp4
-rw-r--r--src/Duet3_V06/Pins_Duet3_V06.h1
2 files changed, 5 insertions, 0 deletions
diff --git a/src/Duet3_V06/Pins_Duet3_V06.cpp b/src/Duet3_V06/Pins_Duet3_V06.cpp
index 9d8cbd5f..5fa45a32 100644
--- a/src/Duet3_V06/Pins_Duet3_V06.cpp
+++ b/src/Duet3_V06/Pins_Duet3_V06.cpp
@@ -29,6 +29,10 @@ bool LookupPinName(const char *pn, LogicalPin &lpin, bool &hardwareInverted) noe
for (size_t lp = 0; lp < ARRAY_SIZE(PinTable); ++lp)
{
const char *q = PinTable[lp].pinNames;
+ if (q == nullptr)
+ {
+ continue;
+ }
while (*q != 0)
{
// Try the next alias in the list of names for this pin
diff --git a/src/Duet3_V06/Pins_Duet3_V06.h b/src/Duet3_V06/Pins_Duet3_V06.h
index de43b2c4..4d5f1244 100644
--- a/src/Duet3_V06/Pins_Duet3_V06.h
+++ b/src/Duet3_V06/Pins_Duet3_V06.h
@@ -388,6 +388,7 @@ constexpr PinEntry PinTable[] =
#endif
constexpr unsigned int NumNamedPins = ARRAY_SIZE(PinTable);
+static_assert(NumNamedPins == 32+32+32+32+6);
// Function to look up a pin name pass back the corresponding index into the pin table
bool LookupPinName(const char *pn, LogicalPin& lpin, bool& hardwareInverted) noexcept;