Module: wine Branch: master Commit: 5d5699569651acaafb4db84f2925368e92ad93f3 URL: http://source.winehq.org/git/wine.git/?a=commit;h=5d5699569651acaafb4db84f29...
Author: Alexandre Julliard julliard@winehq.org Date: Thu Jul 16 11:15:00 2009 +0200
wrc: Avoid a crash if a file didn't contain any resources.
---
tools/wrc/parser.y | 16 +++++++++------- 1 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/tools/wrc/parser.y b/tools/wrc/parser.y index f891f24..d905475 100644 --- a/tools/wrc/parser.y +++ b/tools/wrc/parser.y @@ -386,15 +386,17 @@ resource_file $1 = rsc;
/* Final statements before were done */ - head = get_resource_head($1); - if (resource_top) /* append to existing resources */ + if ((head = get_resource_head($1)) != NULL) { - resource_t *tail = resource_top; - while (tail->next) tail = tail->next; - tail->next = head; - head->prev = tail; + if (resource_top) /* append to existing resources */ + { + resource_t *tail = resource_top; + while (tail->next) tail = tail->next; + tail->next = head; + head->prev = tail; + } + else resource_top = head; } - else resource_top = head; sttres = NULL; } ;