allwpilib icon indicating copy to clipboard operation
allwpilib copied to clipboard

Detect when SimDevice.create* is creating a duplicate and report an error

Open spacey-sooty opened this issue 10 months ago • 1 comments

Right now if I create two identical SimBooleans from the same SimDevice I just get a null pointer exception, a message saying the names conflict would be nice.

spacey-sooty avatar Jan 24 '25 15:01 spacey-sooty

Someone more knowledgeable about the HAL than me would need to check if this would violate an assumption about the return value of HAL_CreateSimDevice(), but I think we could change the return value in SimDeviceData::CreateDevice to a unique negative error code which SimDevice.create() could detect to throw an exception instead of returning null.

KangarooKoala avatar Jan 26 '25 22:01 KangarooKoala