Skip to content
Browse files

fix an infinite loop in locate_file(); avoid printing errors

  • Loading branch information...
1 parent b94952e commit 6a473046b80ba63de7705c6a55082b750f206474 @fmarcia committed
Showing with 8 additions and 4 deletions.
  1. +4 −1 zencoding/zen_editor.py
  2. +4 −3 zencoding/zen_file.py
View
5 zencoding/zen_editor.py
@@ -472,7 +472,10 @@ def update_image_size(self, window):
def encode_decode_base64(self, window):
self.set_context(window)
self.buffer.begin_user_action()
- zen_actions.encode_decode_base64(self)
+ try:
+ zen_actions.encode_decode_base64(self)
+ except:
+ pass
self.buffer.end_user_action()
#---------------------------------------------------------------------------------------
View
7 zencoding/zen_file.py
@@ -27,14 +27,15 @@ def locate_file(editor_file, file_name):
"""
result = ''
+ previous_parent = ''
parent = os.path.dirname(editor_file)
- while parent and os.path.exists(parent):
+ while parent and os.path.exists(parent) and parent != previous_parent:
tmp = create_path(parent, file_name)
if os.path.exists(tmp):
result = tmp
break
-
- parent = os.path.dirname(editor_file)
+ previous_parent = parent
+ parent = os.path.dirname(parent)
return result

0 comments on commit 6a47304

Please sign in to comment.
Something went wrong with that request. Please try again.