commit 34524a3c5da2a8f6e9e13e112b6c55cc71e757ea
parent e04bd49636ef3490a8f4845189e4c9c9cfa1b059
Author: Sebastiano Tronto <sebastiano.tronto@gmail.com>
Date: Sat, 20 Nov 2021 16:28:02 +0100
Bugfix in reading scramble
Diffstat:
4 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/TODO.md b/TODO.md
@@ -3,9 +3,6 @@
This is a list of things that I would like to add or change at some point.
It's more of a personal reminder than anything else.
-## Bugs
-* Segfault on "nissy solve -s 10U" (no space between 10 and U)
-
## Commands
### Commands that are available in nissy 1.0, but not in this version (yet):
diff --git a/nissy-2.0beta3.tar.gz b/nissy-2.0beta3.tar.gz
Binary files differ.
diff --git a/src/alg.c b/src/alg.c
@@ -231,7 +231,7 @@ new_alg(char *str)
}
move_read = false;
- for (j = 0; j < NMOVES; j++) {
+ for (j = U; j < NMOVES; j++) {
if (str[i] == move_string(j)[0] ||
(str[i] >= 'a' && str[i] <= 'z' &&
str[i] == move_string(j)[0]-('A'-'a') && j<=B)) {
diff --git a/src/commands.c b/src/commands.c
@@ -322,8 +322,8 @@ read_scramble(int c, char **v, CommandArgs *args)
unsigned int j;
char *algstr;
- if (new_alg(v[0])->len == 0) {
- fprintf(stderr, "%s: moves or option unrecognized\n", v[0]);
+ if (c < 1 || new_alg(v[0])->len == 0) {
+ fprintf(stderr, "Error reading scramble\n");
return false;
}