commit | 5b695f393e6777aad4618d55f2b507e57bb4dc4b | [log] [tgz] |
---|---|---|
author | Doug Zongker <dougz@android.com> | Wed Feb 24 15:03:47 2010 -0800 |
committer | Doug Zongker <dougz@android.com> | Wed Feb 24 15:05:07 2010 -0800 |
tree | a8e3ef7c71386ac617b48d9f18ca19edfb7e33a5 | |
parent | c4351c791052ad529a4e83c600b1aa6e6420ea86 [diff] |
make StringValue wrapper okay to call on NULL The docs say "don't do this", but it's trivial to make safe. Make StringValue(NULL) return NULL instead of crashing. Change-Id: I2221bcb4c98d8adb4e25c764d7bdcfa787822bcf
diff --git a/edify/expr.c b/edify/expr.c index 7a5b2fb..3600075 100644 --- a/edify/expr.c +++ b/edify/expr.c
@@ -50,6 +50,7 @@ } Value* StringValue(char* str) { + if (str == NULL) return NULL; Value* v = malloc(sizeof(Value)); v->type = VAL_STRING; v->size = strlen(str);