From def528043eacbd96f369cf129af1dc8a54615bc5 Mon Sep 17 00:00:00 2001
From: Nayuki Minase <nayuki@eigenstate.org>
Date: Thu, 21 Apr 2016 02:31:09 +0000
Subject: [PATCH] Added an assertion check to C++ code.

---
 cpp/QrCode.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/cpp/QrCode.cpp b/cpp/QrCode.cpp
index ec701a7..450c4cc 100644
--- a/cpp/QrCode.cpp
+++ b/cpp/QrCode.cpp
@@ -334,6 +334,8 @@ std::vector<uint8_t> qrcodegen::QrCode::appendErrorCorrection(const std::vector<
 				result.push_back(blocks.at(j).at(i));
 		}
 	}
+	if (result.size() != static_cast<unsigned int>(getNumRawDataModules(version) / 8))
+		throw "Assertion error";
 	return result;
 }