Skip to content

Commit

Permalink
fix(build): check if release yaml is nil before accessing hash (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua-Anderson authored Aug 29, 2016
1 parent 25a8e0d commit dcad3f0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rootfs/builder/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ if [[ -f "$build_root/Procfile" ]]; then
fi
default_types=""
if [[ -s "$build_root/.release" ]]; then
default_types=$(ruby -e "require 'yaml';puts (YAML.load_file('$build_root/.release')['default_process_types'] || {}).keys().join(', ')")
default_types=$(ruby -e "require 'yaml';puts ((YAML.load_file('$build_root/.release') || {})['default_process_types'] || {}).keys().join(', ')")
[[ $default_types ]] && echo_normal "Default process types for $buildpack_name -> $default_types"
fi

Expand All @@ -184,7 +184,7 @@ else
fi

if [[ ! -f "$build_root/Procfile" ]]; then
if [[ -s "$build_root/.release" ]]; then
if [[ -s "$build_root/.release" ]] && [[ $default_types ]]; then
ruby -e "require 'yaml';procTypes = (YAML.load_file('$build_root/.release')['default_process_types']);open('$build_root/Procfile','w') {|f| YAML.dump(procTypes,f)}"
else
echo "{}" > $build_root/Procfile
Expand Down

0 comments on commit dcad3f0

Please sign in to comment.