From d1664b4275108c217f54f1fe74c63815f19ce6cc Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Tue, 15 Mar 2016 17:20:10 +0000 Subject: [PATCH] Add asserts. --- HD44780.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/HD44780.cpp b/HD44780.cpp index 4b0bf66..4cf69ae 100644 --- a/HD44780.cpp +++ b/HD44780.cpp @@ -32,6 +32,8 @@ m_rows(rows), m_cols(cols), m_fd(-1) { + assert(rows > 1U); + assert(cols > 15U); } CHD44780::~CHD44780() @@ -90,6 +92,10 @@ void CHD44780::setDStar() void CHD44780::writeDStar(const char* my1, const char* my2, const char* your) { + assert(my1 != NULL); + assert(my2 != NULL); + assert(your != NULL); + if (m_rows > 2U) { char buffer[40U]; @@ -145,6 +151,8 @@ void CHD44780::setDMR() void CHD44780::writeDMR(unsigned int slotNo, unsigned int srcId, bool group, unsigned int dstId, const char* type) { + assert(type != NULL); + if (slotNo == 1U) { char buffer[40U]; if (m_cols > 16U) @@ -190,6 +198,9 @@ void CHD44780::setFusion() void CHD44780::writeFusion(const char* source, const char* dest) { + assert(source != NULL); + assert(dest != NULL); + if (m_rows > 2U) { char buffer[40U];