From be8a536f91b011a7546aad1277087a64604df586 Mon Sep 17 00:00:00 2001
From: tobias <thinkdifferent055@gmail.com>
Date: Thu, 23 Feb 2017 18:37:39 +0100
Subject: [PATCH] Fixed PadAddListener with right content type

---
 .../server/project/sync/listener/pad/PadAddListener.scala | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/main/scala/de/tobias/playpad/server/server/project/sync/listener/pad/PadAddListener.scala b/src/main/scala/de/tobias/playpad/server/server/project/sync/listener/pad/PadAddListener.scala
index d54899b..72754c1 100644
--- a/src/main/scala/de/tobias/playpad/server/server/project/sync/listener/pad/PadAddListener.scala
+++ b/src/main/scala/de/tobias/playpad/server/server/project/sync/listener/pad/PadAddListener.scala
@@ -17,11 +17,15 @@ class PadAddListener extends Listener {
 		val padId = UUID.fromString(json.get("id").getAsString)
 		val pageId = UUID.fromString(json.get("page").getAsString)
 		val padName = json.get("name").getAsString
-		val padPosition= json.get("position").getAsInt
+		val padPosition = json.get("position").getAsInt
 
 		SqlHelper.insertOrUpdate(connection, SqlDef.PAD, padId, SqlDef.PAD_PAGE_REF, pageId)
 		SqlHelper.insertOrUpdate(connection, SqlDef.PAD, padId, SqlDef.PAD_NAME, padName)
 		SqlHelper.insertOrUpdate(connection, SqlDef.PAD, padId, SqlDef.PAD_POSITION, padPosition)
-		SqlHelper.insertOrUpdate(connection, SqlDef.PAD, padId, SqlDef.PAD_CONTENT_TYPE, null)
+
+		if (!json.get("contentType").isJsonNull) {
+			val contentType = json.get("contentType").getAsString;
+			SqlHelper.insertOrUpdate(connection, SqlDef.PAD, padId, SqlDef.PAD_CONTENT_TYPE, contentType)
+		}
 	}
 }
-- 
GitLab