Commit 3ab253fc authored by rods%netscape.com's avatar rods%netscape.com
Browse files

Added checks for null objects so printing would work.

parent 3f2cd59a
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -79,6 +79,9 @@ nsresult nsButton::QueryInterface(const nsIID& aIID, void** aInstancePtr)
//-------------------------------------------------------------------------
NS_METHOD nsButton::SetLabel(const nsString& aText)
{
  if (NULL == mWnd) {
    return NS_ERROR_FAILURE;
  }
  NS_ALLOC_STR_BUF(label, aText, 256);
  VERIFY(::SetWindowText(mWnd, label));
  NS_FREE_STR_BUF(label);
+4 −0
Original line number Diff line number Diff line
@@ -196,8 +196,12 @@ NS_METHOD nsLabel::GetBounds(nsRect &aRect)
//-------------------------------------------------------------------------
NS_METHOD nsLabel::GetPreferredSize(PRInt32& aWidth, PRInt32& aHeight)
{
  if (nsnull == mContext) {
    return NS_ERROR_FAILURE;
  }
  //nsIFontMetrics * fm = GetFont();;
 // mDeviceContext->GetMetricsFor(mFont, &fm);

  nsIFontMetrics* metrics;
  mContext->GetMetricsFor(*mFont, metrics);

+4 −0
Original line number Diff line number Diff line
@@ -927,6 +927,10 @@ nsIFontMetrics* nsWindow::GetFont(void)
//-------------------------------------------------------------------------
NS_METHOD nsWindow::SetFont(const nsFont &aFont)
{
    if (nsnull == mContext) {
      return NS_ERROR_FAILURE;
    }

    nsIFontMetrics* metrics;
    mContext->GetMetricsFor(aFont, metrics);
    nsFontHandle  fontHandle;