Do not try to execute empty programs.

After failing to read a non-existing file, the shell tried to execute the resulting empty program, which resulted in a null pointer dereference. This patch avoids execution of empty programs.

Review URL: http://codereview.chromium.org/6777005

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7473 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
karlklose@chromium.org 2011-04-01 11:47:42 +00:00
parent ae65366f0b
commit 6de158fc44

View File

@ -1,4 +1,4 @@
// Copyright 2009 the V8 project authors. All rights reserved.
// Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@ -112,6 +112,7 @@ class SourceGroup {
v8::Handle<v8::String> source = ReadFile(arg);
if (source.IsEmpty()) {
printf("Error reading '%s'\n", arg);
continue;
}
if (!ExecuteString(source, file_name, false, true)) {
ExitShell(1);