[PATCH] lfcommands.py crashes if 'path' is None

Christian Tismer tismer at stackless.com
Tue Sep 18 08:01:21 CDT 2012


# HG changeset patch
# User Christian Tismer  <tismer at stackless.com>
# Date 1347972429 -7200
# Branch stable
# Node ID a110a7be04aa27291ed93f295b718877a3c3e6e6
# Parent  495d3c671a8b01f19d5bfdafbbba908331d98879
This code crashes if 'path' is None.
Made it conditional to skip this case.

diff -r 495d3c671a8b -r a110a7be04aa hgext/largefiles/lfcommands.py
--- a/hgext/largefiles/lfcommands.py    Mon Sep 17 15:13:03 2012 -0500
+++ b/hgext/largefiles/lfcommands.py    Tue Sep 18 14:47:09 2012 +0200
@@ -145,8 +145,9 @@
              data = ''
              fd = None
              try:
-                fd = open(path, 'rb')
-                data = fd.read()
+                if path:
+                    fd = open(path, 'rb')
+                    data = fd.read()
              finally:
                  if fd:
                      fd.close()

-- 
Christian Tismer             :^)   <mailto:tismer at stackless.com>
Software Consulting          :     Have a break! Take a ride on Python's
Karl-Liebknecht-Str. 121     :    *Starship* http://starship.python.net/
14482 Potsdam                :     PGP key -> http://pgp.uni-mainz.de
phone +49 173 24 18 776  fax +49 (30) 700143-0023
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
       whom do you want to sponsor today?   http://www.stackless.com/



More information about the Mercurial-devel mailing list