Fixed potentially invalid (unchecked) cast of non-object jsval to object in JS timer construction (bug 17149).

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@3325 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Jens Ayton 2010-05-13 12:59:53 +00:00
parent 0ad38f3e60
commit 51e49ae7fb
3 changed files with 11 additions and 2 deletions

View File

@ -926,6 +926,12 @@ static int baseVertexIndexForEdge(int va, int vb, BOOL textured);
if (EXPECT_NOT(textureName == 0)) [self reifyTexture];
if (gDebugFlags & DEBUG_MISC)
{
LogOpenGLState();
gDebugFlags &= ~DEBUG_MISC;
}
switch (planet_type)
{
case STELLAR_TYPE_ATMOSPHERE:

View File

@ -35,6 +35,7 @@ MA 02110-1301, USA.
#import "OOLoggingExtended.h"
#import "NSFileManagerOOExtensions.h"
#import "OOLogOutputHandler.h"
#import "OODebugFlags.h"
#define kOOLogUnconvertedNSLog @"unclassified.GameController"
@ -250,7 +251,7 @@ static GameController *sSharedController = nil;
// Release anything allocated above that is not required.
[pool release];
#if OOLITE_HAVE_APPKIT
if (fullscreen) [self goFullscreen:(id)YES];
if (fullscreen) [self goFullscreen:nil];
#else
[[NSRunLoop currentRunLoop] run];
#endif
@ -554,6 +555,8 @@ static NSComparisonResult CompareDisplayModes(id arg1, id arg2, void *context)
my_mouse_x = my_mouse_y = 0;
gDebugFlags |= DEBUG_MISC;
while (pauseTarget)
{
CGPoint centerOfScreen = CGPointMake(width/2.0F,height/2.0F);

View File

@ -355,7 +355,7 @@ static JSBool TimerConstruct(JSContext *context, JSObject *inThis, uintN argc, j
}
function = argv[1];
if (!JS_ObjectIsFunction(context, JSVAL_TO_OBJECT(function)))
if (JS_ValueToFunction(context, function) == NULL)
{
OOReportJSBadArguments(context, nil, @"Timer", 1, argv + 1, @"Invalid argument in constructor", @"function");
return NO;