]> git.lizzy.rs Git - nothing.git/commitdiff
(#425) Fail svg2rect on missing player and background
authorrexim <reximkut@gmail.com>
Mon, 15 Oct 2018 19:01:20 +0000 (02:01 +0700)
committerrexim <reximkut@gmail.com>
Mon, 15 Oct 2018 19:01:20 +0000 (02:01 +0700)
devtools/svg2rects.xqe

index b360eb3b74cb8a814420760ffc94aa6aef4f518a..e944b9424f57ccfa3035f8b254628f5ddd09078d 100644 (file)
@@ -65,7 +65,11 @@ let $backplatforms := for $rect in $rects where matches($rect/@id, "^backrect.*"
     $rect/@height, " ",
     replace($rect/@style, ".*fill:#([0-9a-z]{6}).*", "$1")
   )
-return (
+return if (count($player) = 0) then (
+  error(QName('', 'ERROR'), 'Position of the Player is not defined. Create a rectangle with id "player"')
+) else if (count($background) = 0) then (
+  error(QName('', 'ERROR'), 'Color of the Background is not defined. Create a rectangle with id "background"')
+) else (
   $background,
   $player,
   count($platforms),