mirror of
https://github.com/KingDuckZ/dindexer.git
synced 2024-11-25 00:53:43 +00:00
Fix segfault when no actions are found.
This commit is contained in:
parent
76a289df62
commit
265337607e
2 changed files with 7 additions and 0 deletions
|
@ -24,6 +24,7 @@
|
|||
#include <iso646.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <assert.h>
|
||||
|
||||
typedef struct ActionListStruct {
|
||||
char** list;
|
||||
|
@ -39,10 +40,14 @@ static int strcmp_wrapper ( const void* parA, const void* parB );
|
|||
void find_actions (char*** parOut, size_t* parCount) {
|
||||
ActionList list;
|
||||
|
||||
assert(parOut);
|
||||
assert(parCount);
|
||||
|
||||
list.count = 0;
|
||||
foreach_dir(&increase_actionlist, &list);
|
||||
if (0 == list.count) {
|
||||
*parOut = NULL;
|
||||
*parCount = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <getopt.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
|
||||
/* This program can be run either with the name of a subcommand as its first
|
||||
* parameter (eg: dindexer locate), plus some optional parameters that are just
|
||||
|
@ -87,6 +88,7 @@ int main (int parArgc, char* parArgv[]) {
|
|||
specified_action = parArgv[1];
|
||||
else
|
||||
specified_action = "";
|
||||
assert((actions and actions_count) or (not actions and not actions_count));
|
||||
selected_action = foreach_avail_action(&same_action, actions, actions_count, specified_action);
|
||||
|
||||
if (actions_count == selected_action) {
|
||||
|
|
Loading…
Reference in a new issue