Don't dereference a NULL pointer in the case of a null pipe.

e.g.:
ls |> foo.out

sh now behaves the same as it does under SunOS 4.x for this case.
This commit is contained in:
David Greenman 1995-09-20 08:30:56 +00:00
parent 872fd9222e
commit a9e0f8b2e0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=10917

View File

@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: eval.c,v 1.2 1994/09/24 02:57:29 davidg Exp $
* $Id: eval.c,v 1.3 1995/05/30 00:07:11 rgrimes Exp $
*/
#ifndef lint
@ -851,7 +851,8 @@ prehash(n)
{
struct cmdentry entry;
if (n->type == NCMD && goodname(n->ncmd.args->narg.text))
if (n->type == NCMD && n->ncmd.args &&
goodname(n->ncmd.args->narg.text))
find_command(n->ncmd.args->narg.text, &entry, 0);
}