Linux + iPhone Continuity / iMessage / SMS
fix: daemon crashes on startup if image is in the clipboard
Zack Bartel5e6201cde145
diff --git a/src/core/src/clipboard.cpp b/src/core/src/clipboard.cppindex 4fa3ad8..9325dec 100644--- a/src/core/src/clipboard.cpp+++ b/src/core/src/clipboard.cpp@@ -79,13 +79,9 @@ namespace tether {break;}- // Catch-all fallback: if none of our preferred types are found,- // try the first thing the compositor offered.- if (!found && !current_mimes.empty()) {- best_mime = current_mimes[0];- found = true;- }-+ // text-only sync. No text mime => skip it. Reading the+ // first offered mime (image/png) feeds binary into the JSON+ // string field and aborts the daemon on invalid UTF-8.if (!found)return;diff --git a/src/daemon/main.cpp b/src/daemon/main.cppindex 694bc87..b5acf91 100644--- a/src/daemon/main.cpp+++ b/src/daemon/main.cpp@@ -94,7 +94,9 @@ int main(int argc, char** argv) {nlohmann::json j;j["command"] = "clipboard_updated";j["content"] = text;- tether::broadcast_message(j.dump());+ // replace bad UTF-8 instead of throwing; a clipboard+ // app can still mislabel binary as text/plain. Don't abort the daemon.+ tether::broadcast_message(j.dump(-1, ' ', false, nlohmann::json::error_handler_t::replace));});}