Soft'N'Design Software
/
projects
/
trivabble.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e57464d
)
Server: disallow moving from an empty location
author
Raphaël Jakse
<raphael.trivabble@jakse.fr>
Fri, 1 May 2020 16:51:13 +0000
(18:51 +0200)
committer
Raphaël Jakse
<raphael.trivabble@jakse.fr>
Fri, 1 May 2020 16:52:09 +0000
(18:52 +0200)
trivabble-server.js
patch
|
blob
|
blame
|
history
diff --git
a/trivabble-server.js
b/trivabble-server.js
index 6f511e3bc4cbd38e512c535ba8c749cca44656d5..e7333b71f9bfa927d39348aaaae75e1ea06fb360 100644
(file)
--- a/
trivabble-server.js
+++ b/
trivabble-server.js
@@
-567,6
+567,12
@@
function handleCommand(cmdNumber, message, response) {
}
letter = rack[cmd.indexFrom];
+
+ if (!letter) {
+ reply(message, response, cmdNumber, {error: 1, reason: "Moving from an empty location"});
+ return false;
+ }
+
operations.push(() => {
rack[cmd.indexFrom] = "";
});