Aviod seg fault when no file
This commit is contained in:
parent
c7c29d26b7
commit
21c4c72798
1 changed files with 4 additions and 1 deletions
|
|
@ -12,7 +12,10 @@ void
|
||||||
setname(File *f)
|
setname(File *f)
|
||||||
{
|
{
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
snprint(buf, sizeof buf, "%.*S", f->name.n, f->name.s);
|
if(f)
|
||||||
|
snprint(buf, sizeof buf, "%.*S", f->name.n, f->name.s);
|
||||||
|
else
|
||||||
|
buf[0] = 0;
|
||||||
putenv("samfile", buf);
|
putenv("samfile", buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue