From 114a1954fb9577066556a196b7b8881590b3dd17 Mon Sep 17 00:00:00 2001
From: cancel <cancel@cancel.fm>
Date: Mon, 10 Dec 2018 01:27:31 +0900
Subject: [PATCH] Add error message when trying to use OSC MIDI without an OSC
 port

---
 tui_main.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tui_main.c b/tui_main.c
index 92af8a6..2bb403d 100644
--- a/tui_main.c
+++ b/tui_main.c
@@ -31,6 +31,7 @@ static void usage() {
       "\n"
       "    --osc-port <number or service name>\n"
       "        UDP port (or service name) to send OSC messages to.\n"
+      "        This option must be set for OSC output to be enabled.\n"
       "        Default: none\n"
       "\n"
       "    --osc-midi-bidule <path>\n"
@@ -1034,6 +1035,14 @@ int main(int argc, char** argv) {
     app_deinit(&app_state);
     exit(1);
   }
+  if (midi_mode.any.type == Midi_mode_type_osc_bidule && osc_port == NULL) {
+    fprintf(stderr,
+            "MIDI was set to be sent via OSC formatted for Plogue Bidule,\n"
+            "but no OSC port was specified.\n"
+            "OSC output is not possible without specifying an OSC port.\n");
+    app_deinit(&app_state);
+    exit(1);
+  }
   if (osc_port != NULL) {
     if (!app_set_osc_udp(&app_state, osc_hostname, osc_port)) {
       fprintf(stderr, "Failed to set up OSC networking\n");