X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=mvm_cmds.c;h=876deaec6578b6817c17440a3b7bb98dbc714656;hb=6e5faf7bf68cf4e080039c012390f584a065f035;hp=f5976ac68bf100f3aa44022a43162b58b5dd00a1;hpb=144f44c523edfab569e960288dd6d84ad7f4d5f4;p=xonotic%2Fdarkplaces.git diff --git a/mvm_cmds.c b/mvm_cmds.c index f5976ac6..876deaec 100644 --- a/mvm_cmds.c +++ b/mvm_cmds.c @@ -227,10 +227,18 @@ void VM_M_getresolution(void) nr = (int)PRVM_G_FLOAT(OFS_PARM0); - // FIXME bounds check - PRVM_G_VECTOR(OFS_RETURN)[0] = video_resolutions[nr].width; - PRVM_G_VECTOR(OFS_RETURN)[1] = video_resolutions[nr].height; - PRVM_G_VECTOR(OFS_RETURN)[2] = 0; + if(nr < 0 || nr >= video_resolutions_count) + { + PRVM_G_VECTOR(OFS_RETURN)[0] = 0; + PRVM_G_VECTOR(OFS_RETURN)[1] = 0; + PRVM_G_VECTOR(OFS_RETURN)[2] = 0; + } + else + { + PRVM_G_VECTOR(OFS_RETURN)[0] = video_resolutions[nr].width; + PRVM_G_VECTOR(OFS_RETURN)[1] = video_resolutions[nr].height; + PRVM_G_VECTOR(OFS_RETURN)[2] = 0; + } } /*