Skip to content

Commit

Permalink
Correct key unlocking and add few checks
Browse files Browse the repository at this point in the history
  • Loading branch information
coditva committed Nov 24, 2017
1 parent c9a34f4 commit f433c79
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/command.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ int get_motion()
{
input_key_t key = interface_input_key();

while (!key_unlocked(key)) {
if (!key_unlocked(key)) {
return 0;
}
return key;
Expand Down Expand Up @@ -197,7 +197,7 @@ command_t * command_get()
{
command_t *command;

while (1) {
do {
/* check if it's a command line */
if ((command = get_command_line()) != NULL)
return command;
Expand All @@ -215,23 +215,21 @@ command_t * command_get()
}
command -> motion.value = get_motion();

/* we could not form any command */
if (command -> motion.value == 0) {
continue;
}
}
/* we could not form any command */
} while (command -> motion.value == 0);

return command;
}

void command_exec(const map_t *map, const command_t *command)
{
int count = command -> count;
int count;

if (command -> type == COMMAND_NOP) {
if (command == NULL || command -> type == COMMAND_NOP) {
return;
}

count = command -> count;
while (count--) {

int count2 = command -> motion.count;
Expand Down

0 comments on commit f433c79

Please sign in to comment.