vanvught / rpidmx512

Orange Pi DMX512 / RDM / MIDI / OSC / Art-Net / WS28xx / L6470 / Stepper / TLC59711 / PCA9685 / Servo / PWM / TCNet / SMPTE / RDMNet / LLRP / GD32 / GigaDevice / Raspberry Pi
http://www.orangepi-dmx.org/
MIT License
398 stars 108 forks source link

Development #210

Closed hippyau closed 3 years ago

hippyau commented 3 years ago

Fix a linux segfault I was getting

hippyau commented 3 years ago

Ah, yeah that didn't go to plan...

I just added...

if (!Display::Get()) return 0; to...

uint16_t json_get_display(char *pOutBuffer, const uint16_t nOutBufferSize) {
    if (!Display::Get()) return 0;
    const bool isOn = !(Display::Get()->isSleep());
    const uint16_t nLength = static_cast<uint16_t>(snprintf(pOutBuffer, nOutBufferSize, "{\"display\":%s}", isOn ? "true" : "false"));
    return nLength;
}
vanvught commented 3 years ago

Fixed in https://github.com/vanvught/rpidmx512/commit/84caf58aab95ee9a4e2e299d193ab3755e3fbfc6