From e4bb8dc3859c49811c0a7b70ada5dcce79094923 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 13 Jan 2011 00:19:39 +0100 Subject: Guard against invalid light color specifiers from the database --- OpenSim/Framework/PrimitiveBaseShape.cs | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs index 20b9cf1..9a38f23 100644 --- a/OpenSim/Framework/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/PrimitiveBaseShape.cs @@ -708,7 +708,12 @@ namespace OpenSim.Framework return _lightColorR; } set { - _lightColorR = value; + if (value < 0) + _lightColorR = 0; + else if (value > 1.0f) + _lightColorR = 1.0f; + else + _lightColorR = value; } } @@ -717,7 +722,12 @@ namespace OpenSim.Framework return _lightColorG; } set { - _lightColorG = value; + if (value < 0) + _lightColorG = 0; + else if (value > 1.0f) + _lightColorG = 1.0f; + else + _lightColorG = value; } } @@ -726,7 +736,12 @@ namespace OpenSim.Framework return _lightColorB; } set { - _lightColorB = value; + if (value < 0) + _lightColorB = 0; + else if (value > 1.0f) + _lightColorB = 1.0f; + else + _lightColorB = value; } } @@ -735,7 +750,12 @@ namespace OpenSim.Framework return _lightColorA; } set { - _lightColorA = value; + if (value < 0) + _lightColorA = 0; + else if (value > 1.0f) + _lightColorA = 1.0f; + else + _lightColorA = value; } } -- cgit v1.1