Permalink
Browse files

hir: GetLastResult should not return NULL

  • Loading branch information...
1 parent 85e1b81 commit 743c801c278b54e316a38ec0a31feec54188b7ef @indutny committed Apr 12, 2012
Showing with 6 additions and 1 deletion.
  1. +6 −1 src/hir.cc
View
@@ -689,7 +689,12 @@ HIRValue* HIR::GetValue(AstNode* node) {
HIRValue* HIR::GetLastResult() {
- return current_block()->instructions()->tail()->value()->GetResult();
+ HIRValue* res = current_block()->instructions()->tail()->value()->GetResult();
+ if (res == NULL) {
+ return CreateValue(root()->Put(new AstNode(AstNode::kNil)));
+ } else {
+ return res;
+ }
}

0 comments on commit 743c801

Please sign in to comment.