[commands] C++ CommandPtr: Prevent null initialization (#5991)

This commit is contained in:
Starlight220
2023-12-03 02:45:04 +02:00
committed by GitHub
parent 96914143ba
commit 5172ab8fd0
3 changed files with 12 additions and 2 deletions

View File

@@ -22,6 +22,11 @@
using namespace frc2;
CommandPtr::CommandPtr(std::unique_ptr<Command>&& command)
: m_ptr(std::move(command)) {
AssertValid();
}
void CommandPtr::AssertValid() const {
if (!m_ptr) {
throw FRC_MakeError(frc::err::CommandIllegalUse,