mhttpd.js's mhttpd_resize_message() function has an Uncaught TypeError

Issue #135 resolved
Former user created an issue

The value that is returned by the first line in mhttpd.js's mhttpd_resize_message() function document.getElementById("mheader_message"); can be null. This causes an Uncaught TypeError.

Adding a simple check for null in the "if" line would fix this. The following code correctly handles this situation (I've highlighted the null check):

function mhttpd_resize_message() { var d = document.getElementById("mheader_message"); if (d != null && d.currentMessage !== undefined && d.style.display !== 'none') mhttpd_fit_message(d.currentMessage); }

Comments (1)

  1. Stefan Ritt

    Your custom page requires the elements

    <div id="mheader"></div>
    <div id="msidenav"></div>
    

    to be present in order to make the page work. This is described in the custom page documentation on the Wiki. Just ignoring if these elements are not present will not work, since many other parts of the midas custom display scheme will break.

    So I added some code in mhttpd_init() to check the existence of these tags. If they are not present, the page refuses to load.

  2. Log in to comment