Coverity: [skip ci] Bad use of null-like value

This commit is contained in:
wmayer
2020-07-21 12:23:10 +02:00
parent 6b4a5066a4
commit 617668a7f2
5 changed files with 9 additions and 6 deletions

View File

@@ -57,6 +57,7 @@ class HoleGui:
return
if selection[0].DocumentName != doc.Name:
QtGui.QMessageBox.critical(mw, "Wrong document", "Please select a face in the active document")
return
# Note: For some reason setting the Support property here breaks all sorts of things.
# It is done in TaskHole.updateUI() instead
@@ -64,6 +65,7 @@ class HoleGui:
body = FreeCADGui.activeView().getActiveObject("pdbody");
if body is None:
QtGui.QMessageBox.critical(mw, "No active body", "Please create a body or make a body active")
return
feature = doc.addObject("Part::FeaturePython","Hole")
hole = Hole(feature)

View File

@@ -29,9 +29,9 @@ def makeSprocket(P, N, Dr):
w = FCWireBuilder()
sprocket.CreateSprocket(w, P, N, Dr)
sprocketw = Part.Wire([o.toShape() for o in w.wire])
sprocket = doc.addObject("Part::Feature", "Sprocket")
sprocket.Shape = sprocketw
return sprocket
sprocketf = doc.addObject("Part::Feature", "Sprocket")
sprocketf.Shape = sprocketw
return sprocketf
class FCWireBuilder(object):
"""A helper class to prepare a Part.Wire object"""

View File

@@ -173,6 +173,7 @@ class Tank:
return Vector()
if vol >= fp.Shape.Volume:
vol = 0.0
cog = Vector()
for solid in fp.Shape.Solids:
vol += solid.Volume
sCoG = solid.CenterOfMass

View File

@@ -320,11 +320,11 @@ def handle():
f = QtCore.QFile(path)
if f.open(QtCore.QIODevice.ReadOnly | QtCore.QFile.Text):
ALTCSS = encode(QtCore.QTextStream(f).readAll())
HTML = HTML.replace("<!--QSS-->","<style type=\"text/css\">"+ALTCSS+"</style>")
else:
with open(path, 'r') as f:
ALTCSS = encode(f.read())
HTML = HTML.replace("<!--QSS-->","<style type=\"text/css\">"+ALTCSS+"</style>")
HTML = HTML.replace("<!--QSS-->","<style type=\"text/css\">"+ALTCSS+"</style>")
# turn tips off if needed

View File

@@ -152,7 +152,7 @@ def getlinks(html):
rg = re.findall('href="\/wiki\/(.*?)"',l)
if "images" in rg:
rg = None
if "mediawiki" in rg:
elif "mediawiki" in rg:
rg = None
if rg:
rg = rg[0]