rem: while (argc--) {
add: while (argc-- && argv[first] != NULL) {
context: NsTclSchedDailyCmd(ClientData arg, Tcl_Interp *interp, int argc, char **argv){    Callback    *cbPtr;    int          flags;    int          first;    int          id;    int          hour, minute;    /* 12 cases (arg count & number after cmd and -options are handled):     *      0    1        2        3         4         5          6     *   * cmd hour     minute   script                              (4 args)/3     *   * cmd hour     minute   procname                            (4 args)/3     *   * cmd hour     minute   procname  arg                       (5 args)/4     *   * cmd -once    hour     minute    script                    (5 args)/3     *   * cmd -once    hour     minute    procname                  (5 args)/3     *   * cmd -once    hour     minute    procname  arg             (6 args)/4     *   * cmd -thread  hour     minute    script                    (5 args)/3     *   * cmd -thread  hour     minute    procname                  (5 args)/3     *   * cmd -thread  hour     minute    procname  arg             (6 args)/4     *   * cmd -once    -thread  hour      minute    script          (6 args)/3     *   * cmd -once    -thread  hour      minute    procname        (6 args)/3     *   * cmd -once    -thread  hour      minute    procname  arg   (7 args)/4     */    if (argc < 4 || argc > 7) {        Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],			 " ?-once? ?-thread? hour minute "			 "{ script | procname ?arg? }\"", (char *) NULL);        return TCL_ERROR;    }    first = 1;    flags = 0;    while (argc--) {        if (strcmp(argv[first], "-thread") == 0) {            flags |= NS_SCHED_THREAD;        } else if (strcmp(argv[first], "-once") == 0) {            flags |= NS_SCHED_ONCE;        } else {	    break;        }	first++;    }    /*     * First is now the first argument that is not a switch.     */    if (Tcl_GetInt(interp, argv[first++], &hour) != TCL_OK) {        return TCL_ERROR;    }    if (hour < 0 || hour > 23) {        Tcl_AppendResult(interp, "invalid hour \"", argv[first - 1],			 "\": should be >= 0 and <= 23", NULL);        return TCL_ERROR;    }    if (Tcl_GetInt(interp, argv[first++], &minute) != TCL_OK) {        return TCL_ERROR;    }    if (minute < 0 || minute > 59) {        Tcl_AppendResult(interp, "invalid minute \"", argv[first - 1],			 "\": should be >= 0 and <= 59", NULL);        return TCL_ERROR;    }    /*     * Bear in mind that argc has been changed when counting switches,     * so assume that there are no switches when reading the 4 here.     */    cbPtr = NewCallback(interp, argv[first], argv[first+1]);    id = Ns_ScheduleDaily(NsTclSchedProc, cbPtr, flags,			  hour, minute, FreeSched);    return ReturnValidId(interp, id, cbPtr);}