diff --git a/src/lib/deskflow/IClipboard.cpp b/src/lib/deskflow/IClipboard.cpp index 2c23f8663..d4394f7d4 100644 --- a/src/lib/deskflow/IClipboard.cpp +++ b/src/lib/deskflow/IClipboard.cpp @@ -27,13 +27,13 @@ void IClipboard::unmarshall(IClipboard *clipboard, const std::string_view &data, // clear existing data clipboard->empty(); - // read the number of formats - const uint32_t numFormats = readUInt32(index); if (end - index < 4) { LOG_ERR("clipboard unmarshall: truncated header"); clipboard->close(); return; } + // read the number of formats + const uint32_t numFormats = readUInt32(index); index += 4; // read each format