Fixed coverity issues

184348 Bad use of null-like value
175794 Copy-paste error
172913 Copy-paste error
169506 Structurally dead code
169504 Bad use of null-like value
169013 Copy-paste error
This commit is contained in:
Yorik van Havre
2018-11-19 19:36:50 -02:00
parent 31b896ad07
commit 63bb7db4a6
6 changed files with 7 additions and 6 deletions

View File

@@ -1226,7 +1226,7 @@ def processdxf(document,filename,getShapes=False,reComputeFlag=True):
# drawing solids
solids = drawing.entities.get_type("solid")
if solids: FreeCAD.Console.PrintMessage("drawing "+str(len(circles))+" solids...\n")
if solids: FreeCAD.Console.PrintMessage("drawing "+str(len(solids))+" solids...\n")
for solid in solids:
lay = rawValue(solid,8)
if dxfImportLayouts or (not rawValue(solid,67)):

View File

@@ -436,7 +436,7 @@ class _CommandFemMaterialMechanicalNonlinear(CommandManager):
solver_object = None
break
# set solver attribute for nonlinearity for ccxtools CalculiX solver or new frame work CalculiX solver
if hasattr(solver_object, "Proxy") and (solver_object.Proxy.Type == 'Fem::FemSolverCalculixCcxTools' or solver_object.Proxy.Type == 'Fem::FemSolverObjectCalculix'):
if solver_object and hasattr(solver_object, "Proxy") and (solver_object.Proxy.Type == 'Fem::FemSolverCalculixCcxTools' or solver_object.Proxy.Type == 'Fem::FemSolverObjectCalculix'):
print('Set MaterialNonlinearity and GeometricalNonlinearity to nonlinear for ' + solver_object.Label)
solver_object.MaterialNonlinearity = "nonlinear"
solver_object.GeometricalNonlinearity = "nonlinear"

View File

@@ -433,7 +433,7 @@ class GeometryElementsSelection(QtGui.QWidget):
else:
FreeCAD.Console.PrintMessage('Face belongs to more than one solid\n')
solid_to_add = None
found_edge = True
found_face = True
if solid_to_add:
selection = (selection[0], 'Solid' + solid_to_add)
ele_ShapeType = 'Solid'

View File

@@ -315,7 +315,7 @@ class _TaskPanelFemMaterial:
self.material['KinematicViscosity'] = '0 m^2/s'
if 'VolumetricThermalExpansionCoefficient' in self.material:
# unit type of VolumetricThermalExpansionCoefficient is ThermalExpansionCoefficient
if 'ThermalExpansionCoefficient' not in str(Units.Unit(self.material['VolumetricThermalExpansionCoefficient'])):
if 'VolumetricThermalExpansionCoefficient' not in str(Units.Unit(self.material['VolumetricThermalExpansionCoefficient'])):
print('VolumetricThermalExpansionCoefficient in material data seems to have no unit or a wrong unit (reset the value): ' + self.material['Name'])
self.material['VolumetricThermalExpansionCoefficient'] = '0 m/m/K'
else:

View File

@@ -545,7 +545,7 @@ def get_femelement_sets_from_group_data(femmesh, fem_objects):
return False
else:
return True
print("")
#print("")
def get_elset_short_name(obj, i):

View File

@@ -480,7 +480,8 @@ class Writer(object):
dimension = "M/L^3"
if name.startswith("Edge"):
density = None # not tested, but it seems needed because denisty does not exist (IMHO, bernd)
density.Unit = Units.Unit(-2, 1)
if density:
density.Unit = Units.Unit(-2, 1)
dimension = "M/L^2"
density = convert(densityQuantity, dimension)