Fix segfault on edge with no inputs

PR #1281 added a deference of most_recent_input without checking
for NULL, which can occur if a build rule has no inputs.
Check it for null before dereferencing, and add a test.

Fixes #1290.
2 files changed