Fix for issue #6:
"Segfaults when input is piped from non-existant program" modified: src/nms.c
This commit is contained in:
parent
5dff8f3994
commit
b34fc9bf11
10
src/nms.c
10
src/nms.c
@ -44,7 +44,8 @@ char getMaskChar(void);
|
|||||||
* void nms_exec(NmsArgs *)
|
* void nms_exec(NmsArgs *)
|
||||||
*
|
*
|
||||||
* DESCR:
|
* DESCR:
|
||||||
* Performs "decryption" effect,
|
* Performs "decryption" effect, Returns the character pressed at the last pause, or
|
||||||
|
* '\0' (null character) if there are any problems.
|
||||||
*
|
*
|
||||||
* ARGS:
|
* ARGS:
|
||||||
* NmsArgs *args - Pointer to argument structure
|
* NmsArgs *args - Pointer to argument structure
|
||||||
@ -68,6 +69,13 @@ char nms_exec(NmsArgs *args) {
|
|||||||
bool first = true;
|
bool first = true;
|
||||||
char ret = 0;
|
char ret = 0;
|
||||||
|
|
||||||
|
// Lets check args.src and make sure we have text. If not, return
|
||||||
|
// with an error message.
|
||||||
|
if (args->src == NULL) {
|
||||||
|
fprintf(stderr, "Error. No data found in args.src\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Start and initialize curses mode
|
// Start and initialize curses mode
|
||||||
initscr();
|
initscr();
|
||||||
cbreak();
|
cbreak();
|
||||||
|
Loading…
Reference in New Issue
Block a user