firmware-utils: fix segfault introduced by v2 changes

Signed-off-by: Bastian Bittorf <bittorf@bluebottle.com>

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@37724 3c298f89-4303-0410-b956-a3cf2f4a3e73
master
John Crispin 2013-08-06 14:32:50 +00:00
parent 8c6b586f4d
commit a66e96d222
1 changed files with 2 additions and 2 deletions

View File

@ -811,7 +811,7 @@ static int build_fw(void)
int ret = EXIT_FAILURE; int ret = EXIT_FAILURE;
int writelen = 0; int writelen = 0;
int hdr_len; int hdr_len;
if (board->hdr_version == HEADER_VERSION_V2) if (board && board->hdr_version == HEADER_VERSION_V2)
hdr_len = sizeof(struct fw_header_v2); hdr_len = sizeof(struct fw_header_v2);
else else
hdr_len = sizeof(struct fw_header); hdr_len = sizeof(struct fw_header);
@ -854,7 +854,7 @@ static int build_fw(void)
if (!strip_padding) if (!strip_padding)
writelen = buflen; writelen = buflen;
if (board->hdr_version == HEADER_VERSION_V2) if (board && board->hdr_version == HEADER_VERSION_V2)
fill_header_v2(buf, writelen); fill_header_v2(buf, writelen);
else else
fill_header(buf, writelen); fill_header(buf, writelen);