diff options
Diffstat (limited to 'lib/toaster/toastergui/api.py')
-rw-r--r-- | lib/toaster/toastergui/api.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/toaster/toastergui/api.py b/lib/toaster/toastergui/api.py index 1bec56d46..564d595a1 100644 --- a/lib/toaster/toastergui/api.py +++ b/lib/toaster/toastergui/api.py @@ -677,7 +677,13 @@ class XhrCustomRecipe(View): recipe_path = os.path.join(layerpath, "recipes", "%s.bb" % recipe.name) with open(recipe_path, "w") as recipef: - recipef.write(recipe.generate_recipe_file_contents()) + content = recipe.generate_recipe_file_contents() + if not content: + # Delete this incomplete image recipe object + recipe.delete() + return error_response("recipe-parent-not-exist") + else: + recipef.write(recipe.generate_recipe_file_contents()) return JsonResponse( {"error": "ok", |