The DHTML crashes gmod if it attempts to load a URL that does not exist.
Not immediately but after a few seconds as it notices that the webpage doesn't exist.
Is there any way of checking if its a valid URL or a workaround?
What OS are you running the client on? DHTML uses Awesomium which is known to have issues with Linux/OSX. Can you provide exact steps to reproduce the crash, and post the crashlog?
I have a dermamenu with a DHTML panel and run openurl ([url]http://wiki.garrysmod.com/page/HTML/OpenURL[/url]) with an invalid url. After a few seconds it crashes.
Win7 x64 standard.
It crashed multiple times so there are 4 crashreports included: [url]https://mega.co.nz/#!48lyRABb!Ts8YLfrFQaMyA9lYCX0nnoEXJoy-7uS9SWPa_kRsGoM[/url]
I can't seem to reproduce this on either the stable or dev branch. Can you provide more details about the map you were on and the exact code you used to cause the crash?
Your logs are showing a generic exception was thrown, and so aren't especially helpful at first glance.
It's just gm_flatgrass. And by now I've move already modified the code so much that I can'T even reproduce it any more. Also I tried to extract the parts of which im thinking who caused the crash(because i may not share the code since its not mine and im only working on it) into another file and run it but nothing happened.
How are you calling/opening the menu? We can't really help you unless we see the code. You don't have to show us everything, just the important (or, what you think is important) parts.
[CODE]local EMFrame = vgui.Create("DFrame")
EMFrame:SetPos(ScrW()/6, ScrH() * 1.1)
EMFrame:SetSize(ScrW() / 1.5, ScrH() / 1.5)
EMFrame:SetTitle("")
EMFrame:MakePopup()
EMFrame:MoveTo( ScrW()/6, ScrH() / 6, 0.125, 0, 1)
local Contents = vgui.Create("DPanel", EMFrame)
Contents:SetPos(EMFrame:GetWide() * 0.175, EMFrame:GetTall() * 0.205)
Contents:SetSize(EMFrame:GetWide() / 1.22, EMFrame:GetTall() / 1.26)
local ButtonBar = vgui.Create("DPanel", EMFrame)
ButtonBar:SetPos(0,0)
ButtonBar:SetSize(EMFrame:GetWide(), EMFrame:GetTall() / 5)
local CloseButt = vgui.Create("DButton", EMFrame)
CloseButt:SetPos(3, ButtonBar:GetTall() * 0.01)
CloseButt:SetSize(EMFrame:GetWide() / 6.75, EMFrame:GetTall() / 5.1)
CloseButt:SetText("Close")
CloseButt:SetFont("ButtonText")
CloseButt.DoClick = function ()
motdopen = false
EMFrame:Close()
end
local HtmlFrame = vgui.Create( "DHTML", Contents )
HtmlFrame:SetPos( 0, 0 )
HtmlFrame:SetSize( Contents:GetWide(), Contents:GetTall() )
ContentText = vgui.Create("DButton", Contents)
ContentText:SetPos(4, 4)
ContentText:SetTextColor(elegant_motd.NewsTextColor)
ContentText:SetFont("NewsText")
ContentText:SetText("test")
ContentText:SizeToContents()
ContentText:SetContentAlignment( 7 )
function ContentText:Paint() end
local function openstuff(stuff)
ContentText:SetDisabled(true)
ContentText:SetCursor("arrow")
if true then
if true then
ContentText:Clear()
--ContentText:SetPos(EMFrame:GetWide() / 3.25, EMFrame:GetTall() / 6)
local t = 0
ContentText:SetText("")
local c = 1
function ContentText:Paint()
local w,h = self:GetSize()
local sx, sy = w-4,2
t = t + math.Clamp(math.Rand(-4,1)*math.Rand(0,2)*math.Rand(0,3),0,3.6)
local am = t%50
surface.SetDrawColor(Color(41,44,49))
surface.DrawRect((w-sx)/2-1,0,sx+4,sy+2)
surface.SetDrawColor(Color(255,255,255,45))
surface.DrawRect((w-sx)/2,1,sx*((t%50)/50),sy)
end
--ContentText:SetTextAlign(TEXT_ALIGN_CENTER)
ContentText.Think = function()
end
HtmlFrame:OpenURL( stuff )
HtmlFrame:SetVisible(true)
HtmlFrame:SetSize( Contents:GetWide(), Contents:GetTall() )
end
end
end
local ButtonScroll = vgui.Create( "DScrollPanel", EMFrame )
ButtonScroll:SetSize( EMFrame:GetWide() / 6, EMFrame:GetTall() / 1.265 )
ButtonScroll:SetPos( 4, EMFrame:GetTall() * 0.205 )
local Button = vgui.Create("DButton", ButtonScroll)
Button:SetPos(0, 35)
Button:SetSize(ButtonScroll:GetWide() / 1.125, 32)
Button:SetText("testopen")
Button:SetFont("ButtonText")
Button:SetTextColor(Color(255,255,255))
Button.DoClick = function()
openstuff( "http://www.redlineo" )
end
local Button2 = vgui.Create("DButton", ButtonScroll)
Button2:SetPos(0, 35*2)
Button2:SetSize(ButtonScroll:GetWide() / 1.125, 32)
Button2:SetText("testopen")
Button2:SetFont("Button2Text")
Button2:SetTextColor(Color(255,255,255))
Button2.DoClick = function()
openstuff( "http://www.google.com" )
end[/CODE]
The menu is called by chatcommand or console command. But as I said I can't even reproduce it anymore.
I can't reproduce it with the code either. It might be related to one of the issues fixed with the latest update. Let us know if it crops up again.
Change it and just use HTML instead of DHTML. It doesn't crashed it will only through errors which you can suppress if needed
Sorry, you need to Log In to post a reply to this thread.