src/glRenderer.cpp

changeset 958
1dc890c73e01
parent 952
f116b63c4844
child 962
a4b463a7ee82
--- a/src/glRenderer.cpp	Sun Aug 30 03:52:03 2015 +0300
+++ b/src/glRenderer.cpp	Sun Aug 30 04:21:44 2015 +0300
@@ -519,7 +519,8 @@
 //
 Vertex GLRenderer::coordconv2_3 (const QPoint& pos2d, bool snap) const
 {
-	assert (camera() != EFreeCamera);
+	if (camera() == EFreeCamera)
+		return Origin;
 
 	Vertex pos3d;
 	const LDFixedCamera* cam = &g_FixedCameras[camera()];
@@ -973,7 +974,9 @@
 	for (qint32 idx : indices)
 	{
 		LDObject* obj = LDObject::fromID (idx);
-		assert (obj != null);
+
+		if (obj == null)
+			continue;
 
 		// If this is an additive single pick and the object is currently selected,
 		// we remove it from selection instead.
@@ -1264,16 +1267,18 @@
 //
 void GLRenderer::setDepthValue (double depth)
 {
-	assert (camera() < EFreeCamera);
-	currentDocumentData().depthValues[camera()] = depth;
+	if (camera() < EFreeCamera)
+		currentDocumentData().depthValues[camera()] = depth;
 }
 
 // =============================================================================
 //
 double GLRenderer::getDepthValue() const
 {
-	assert (camera() < EFreeCamera);
-	return currentDocumentData().depthValues[camera()];
+	if (camera() < EFreeCamera)
+		return currentDocumentData().depthValues[camera()];
+	else
+		return 0.0;
 }
 
 // =============================================================================
@@ -1635,6 +1640,8 @@
 
 LDFixedCamera const& GetFixedCamera (ECamera cam)
 {
-	assert (cam != EFreeCamera);
-	return g_FixedCameras[cam];
+	if (cam != EFreeCamera)
+		return g_FixedCameras[cam];
+	else
+		return g_FixedCameras[0];
 }

mercurial